[Pas2js] Prefix_&_support

Ondrej Pokorny lazarus at kluug.net
Tue May 15 12:53:54 CEST 2018


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 (&)?

> But I can also use it as a suffix if you prefer that. It should solve 
> your completion problem.

Yes, suffixes like 1, 2, 3... can solve the problem of case-sensitive 
data structure on one side and case-insensitive Pascal code on the other 
side.

Btw. the new Lazarus identifier completion finds identifiers containing 
a phrase as well - it doesn't have to start with it.

Ondrej


More information about the Pas2js mailing list