[Pas2js] Prefix_&_support

Michael Van Canneyt michael at freepascal.org
Tue May 15 13:01:13 CEST 2018



On Tue, 15 May 2018, Ondrej Pokorny wrote:

> On 15.05.2018 12:37, Michael Van Canneyt wrote:
>> On Mon, 14 May 2018, warleyalex via Pas2js wrote:
>>
>>> Let's say in your application, move your cursor beyond the . (period
>>> character) I think it's a good practice to prefix all Pascal 
>>> identifies with an &
>>> prefix, usually declared in external classes, so the pas2js compiler 
>>> can correctly
>>> compile the code,
>>> it won't get name conflict, just because have already evaluated the
>>> identifier, for instance in:
>>
>> This is largely a matter of preference.
>
> Not really. Especially in data binding the & prefix can clearly bind 
> data structure to pascal structure.
>
>> For me, & is an operator symbol, not part of a symbol name, so I use _ 
>> instead.
>
> I am not aware & is an operator in pascal. On the other hand, & is 
> exactly for the purpose of escaping identifiers in object pascal. Why do 
> you want to use something you come up with (_) instead of what object 
> pascal natively offers (&)?

See my first sentence.

& represents an operator, namely to indicate octal numbers.

begin
   writeln(&123);
end.

Will write 83.

Michael.


More information about the Pas2js mailing list