[fpc-pascal] specify variable name with string variable

Darius Blaszyk dhkblaszyk at gmail.com
Mon Jul 8 17:31:35 CEST 2019


> This might sound silly,  but is it possible to somehow specify a variable
> with a string containing the name of the variable?


Yes it certainly is. I wrote a unit that can handle arbitrary variable
types for my project pmake. Pmake it a build tool for pascal.

https://github.com/daar/pmake/blob/master/pmake/pmake_variables.pas

To set a variable, simply use: set_(“myvar”, 3.141). To read it, use:
writeln(val_(“myvar”)).

Rgds, Darius
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20190708/f5ae6e61/attachment.html>


More information about the fpc-pascal mailing list