[ragel-users] Why not prepend a prefix to variables used by ragel?

Nate nate at n4te.com
Sat Feb 23 07:39:06 UTC 2019


Using function parameters as you've done helps a little, but embedded
actions need to deal directly with the Ragel variable names. IMHO, there is
almost no case where single or two letter abbreviations can be considered
readable. I can get by with it of course, it's just not super pleasant.


On Sat, Feb 23, 2019 at 1:29 PM Daniel Beecham <daniel at lunix.se> wrote:

> I don’t find the variable names to particularly confusing - we usually
> have a function
>
> int something_parse(struct something_parser_s * parser, char * buf, int
> buf_len) {
>   char * p = buf;
>   char * pe = buf + buf_len;
>   %%write exec;
> }
>
> Which is pretty easy to read. The cs variable is stored in the structure,
> which gives us partial reads for free; so a rg_ prefix isn’t very necessary
> there either. (parser->cs reads like “parsers current state”, which is good
> enough I think).
>
> If you feel strongly about it, variable can solve your readability
> problems.
>
> lör 23 feb. 2019 kl. 13:12 skrev Peng Yu <pengyu.ut at gmail.com>:
>
>> This can be easily solved but adding a command line option to enable such
>> prefixes and the date the prefixes will be enforced (say in 3 years). So
>> people can have time to migrate their ragel code. This kind of things has
>> been done all the time. I don’t think it should be an excuse not make the
>> variable name more readable. “access” can solve the readability problem,
>> but it also uses an extra structure which changes the meaning of the code.
>> I will check “variable” later.
>>
>> BTW, how many uses of ragel anyway? It seems to have a far less user base
>> than flex. My impression is that people uses it because it can offer
>> something flex does not offer. However, flex can already solve a lot of
>> lexing problems. So there will be much less users use ragel than flex. This
>> can be shown by the numbers of questions on stack overflow and the numbers
>> of projects on github.
>>
>> On Sat, Feb 23, 2019 at 3:52 AM Adrian Thurston <thurston at colm.net>
>> wrote:
>>
>>> You can use the variable and access statements (section 5 of the
>>> manual).
>>>
>>> Changing the default behaviour at this point would break every ragel
>>> program out there and that's not something I'm interested in doing.
>>>
>>> On 2019-02-22 21:23, Peng Yu wrote:
>>> > The variables mentioned in section 5.1 "Variables Used by Ragel"
>>> > manual are very much like common names. It will be confusing to look
>>> > at ragel code written in this way. Why not consider adding a prefix,
>>> > e.g., rg_, to them to make it less confusing? Thanks.
>>> >
>>> > - cs
>>> > - p
>>> > - ...
>>>
>>> _______________________________________________
>>> ragel-users mailing list
>>> ragel-users at colm.net
>>> http://www.colm.net/cgi-bin/mailman/listinfo/ragel-users
>>
>> --
>> Regards,
>> Peng
>> _______________________________________________
>> ragel-users mailing list
>> ragel-users at colm.net
>> http://www.colm.net/cgi-bin/mailman/listinfo/ragel-users
>
> _______________________________________________
> ragel-users mailing list
> ragel-users at colm.net
> http://www.colm.net/cgi-bin/mailman/listinfo/ragel-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.colm.net/pipermail/ragel-users/attachments/20190223/72223e53/attachment.html>


More information about the ragel-users mailing list