[Pas2js] Prefix_&_support
Michael Van Canneyt
michael at freepascal.org
Tue May 15 14:25:57 CEST 2018
On Tue, 15 May 2018, Ondrej Pokorny wrote:
> 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.
As said, I consider it a matter of preference.
It's not because a certain technology exists that you must use it.
However, I can understand the argument about code completion,
and henceforward I will use a suffix.
But I will not use & in APIs I translate.
You are of course free to do as you please, if you prefer to use &,
be my guest :)
Michael.
More information about the Pas2js
mailing list