[Pas2js] Prefix_&_support

Ondrej Pokorny lazarus at kluug.net
Tue May 15 13:16:54 CEST 2018


On 15.05.2018 13:01, Michael Van Canneyt wrote:
> See my first sentence.
>
> & represents an operator, namely to indicate octal numbers.
>
> begin
>   writeln(&123);
> end.
>
> Will write 83.

True. I forgot about this one. But is & really an operator? 
https://www.freepascal.org/docs-html/ref/refse84.html
Isn't this a prefix (=a part of number or identifier) instead?:
1.) for numbers it means octal representation.
2.) for identifiers, keywords etc. it means it's an identifier

I mean what is a dot (.) for you: a floating point separator or a class 
operator?:
1.) 123.456
2.) abc.def

Why should you not want to use the dot in the first or the second case 
just because it is used in the second or the first case?

Btw. if I am not mistaken numbers cannot be identifiers in JS. So no 
chance to have an ambiguity here with "&123" being an identifier.

Ondrej


More information about the Pas2js mailing list