Re: Bug in get() and value(): embedded comments
- Posted by CChris <christian.cuvier at agricu??ure.gouv.fr> Jul 25, 2007
- 610 views
Jason Gade wrote: > > What do comments have to do with value() or Euphoria objects? Comments may appear in string representations of Euphoria objects - more precisely, of sequences. > What do valid > Euphoria statements have to do with converting between strings and objects? > Euphoria statements are conveyed by strings, some of which represent Euphoria objects. When a statement is valid, all the substrings it uses are valid too as object representations - otherwise compile would fail. > I'm confused at the need for this. > This is needed for two types of reasons: 1/ It is valid to use comments inside Euphori object representations, yet value() and get() can't read them properly. This is the very definition of a bug. 2/ Don't you think the following is the simplest .ini file format? "{ -- first parameter, bla bla 127, -- second parameter, for other purposes \"myfile.txt\", -- and on and on }" Making this the contents of a config file allows anyone to edit/customise it without the need of a specific interface. Reading the config file would be done by get(), followed by a few assignments from the sequence read to variables intended to receive the persistent values. Writing is hardly more complex using a sprint() and a list of the comment tags. CChris > -- > "Any programming problem can be solved by adding a level of indirection." > --anonymous > "Any performance problem can be solved by removing a level of indirection." > --M. Haertel > "Premature optimization is the root of all evil in programming." > --C.A.R. Hoare > j.