[fpc-devel] Proposal: Enhanced replacement for assignment operators
Martin
fpc at mfriebe.de
Fri Aug 6 19:52:32 CEST 2010
On 06/08/2010 18:29, Alexander Klenin wrote:
> On Sat, Aug 7, 2010 at 02:34, Martin<fpc at mfriebe.de> wrote:
>> On 06/08/2010 16:21, Alexander Klenin wrote:
>> It's not about implementation in the fpc parser/compiler, or syntax
>> highlighter => you can implement any such thing...
>>
>> But it's breaking the fundamentals of pascal, to differentiate between
>> symbol and identifiers.
> No, this is not fundamentals, this is minor syntactic point.
> The fundamentals are things like readability, orthogonality etc.
> (randomly chosen example:
> http://xenia.media.mit.edu/~tpminka/PLE/linguistics.html#3)
"readability"
IMHO that would include the distinguishably of individual parts of the
language .... "div=" just isn't readable at all (it is understandable,
because it's meaning can be derived, but it isn't readable.
>> Obviously it acts like a symbol does, so it should be a symbol; but if
>> symbol can have chars, then why can't identifiers have $+-...
> 1) Since div and mod are already symbols, this distinction is already broken.
Actually, are they? or are they keywords?
(in which case of course, I myself was to limited in my original
statement, as it can also be said div= acts like a keyword)
>> ----------
>> if there should be a shorthand for "a:=a mod b" => ok => but please make it
>> look like pascal.
>> Either inc style, or symbol style. maybe use "%=" (and "::=" for div (first ":" =divide))
>> I don't say I like those, but "mod=" is just the worst I can imagine.
> Let's return to the orthogonality principle for the moment.
> It is, IMO, very simple and easily memorable rule:
> "a<op>= b" is equivalent to "a := a<op> b".
> Instead, we now have "a<op>= b" is equivalent to "a := a<op> b"
> if<op> if is addition, subtraction, multiplication or
> floating-point (!) division.
> I think that adding rule "a<op1>= b" is equivalent to "a := a<op2> b"
> where op1 and op2 are different is much worse than
> some allowing few more "mixed" tokens into the language.
>
> If you see
> a div= b;
> operator, you may aesthetically dislike it, but you will
> instantly recognize what it does.
"aesthetically dislike " = bad readability => see above...
Well yes, having a different symbol, is not good (I wrote I did not like
it) => but having "div=" is equally not good. That leaves the option of
having neither. => Having neither is the answer you should always find
to, if all known alternatives are at best a (bad) compromise.
But to follow up, if <op>= was allowed for all and any op:
BoolVal == OtherBool; // BoolVal := Boolval = OtherBool;
There is nothing wrong with it => except I wouldn't be to sure, how many
people would actually read the correct meaning into it, if they did not
know before?
More information about the fpc-devel
mailing list