D-styled data file
Saaa
empty at needmail.com
Wed Apr 29 04:44:00 PDT 2009
Thanks for your reply
"Georg Wrede" <georg.wrede at iki.fi> wrote in message
news:gt96lc$dig$1 at digitalmars.com...
> Saaa wrote:
>> I changed the prototype to:
>>
>> void get(in char[] varName, ...)
>>
>> I'm not totally happy with it because I only need one variadic argument
>> and :
>>
>> How do I get the .stringof of an variadic type?
>> _arguments[0].stringof doesn't work :)
>>
>> How do I mutate the original argument? (ref)
>>
>> Please tell me if I'm on the totally wrong track here.
>
> What you're doing is called serialization.
Isn't serialization the other way around?
Of course a d-styled fileformat would be very handy when it comes to
serialization,
but I started because of the inverse: I wanted to read data which would be
easily put into D types.
>
> I often find it good to get some background info. That often helps me
> rethink and maybe redefine the problem. It takes time to read stuff, but
> in the end it often saves even more time. Or effort. A couple of pointers:
>
> http://en.wikipedia.org/wiki/Serialization_(computing)#Human-readable_serialization
>
> Thinking about what your file might look like could also help:
>
> http://en.wikipedia.org/wiki/JSON#Data_types.2C_syntax_and_example
The problem with this format (to me) would be that multidimensional arrays
aren't standard.
Because the compiler can (of course) already read d styled data files I know
the code
must be there already.
I'm still dangling between a full parsing at load and parse on demand.
A parse on demand (get) would do the following steps:
Get the type of the variable in which the data must be stored (in string
format)
Search for this type in every line of the char[][], when found check whether
the name is the same
and then convert the chars to that type and place the data in the variable.
More information about the Digitalmars-d-learn
mailing list