[fpc-pascal] Dot syntax for types?

Michael Van Canneyt michael at freepascal.org
Sun Jan 14 16:19:58 CET 2018



On Sun, 14 Jan 2018, Sven Barth via fpc-pascal wrote:

> On 14.01.2018 09:56, Michael Van Canneyt wrote:
>> 
>> 
>> On Sun, 14 Jan 2018, Ryan Joseph wrote:
>> 
>>> I remember I heard about a mode switch that requires "type groups”
>>> (what are these called btw?) to use a . and be prefixed. For example:
>>>
>>> type
>>>     TGLType = (GL_FLOAT, GL_UNSIGNED_BYTE);
>>>
>>>
>>> TGLType.GL_FLOAT would be the full name (note GL_FLOAT already is
>>> declared so I want the type to be explicitly TGLType.GL_FLOAT in all
>>> cases). I need to make some wrappers around OpenGL types and I thought
>>> this would be a nice way to do it instead of declaring a bunch of
>>> constants with prefixes but I just can’t remember how to handle that
>>> dot syntax (maybe it’s in the trunk under development). Thanks.
>> 
>> Try
>> {$SCOPEDENUMS ON}
>> 
>> see
>> https://www.freepascal.org/docs-html/current/prog/progsu70.html#x77-760001.2.70
>
> Maybe a bit of that documentation can be added to the enumerations
> section of the language reference guide as well? After all the
> functionality itself is part of the language and one might not know that
> that this feature a) exists and b) that it needs a directive to be enabled.

Absolutely right, and I had already added this to my todo list :)

Michael.


More information about the fpc-pascal mailing list