[Issue 1985] import expression should return ubyte[] not string

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Apr 11 05:36:11 PDT 2008


http://d.puremagic.com/issues/show_bug.cgi?id=1985





------- Comment #6 from wbaxter at gmail.com  2008-04-11 07:36 -------
(In reply to comment #5)
> Answer to comment #4
> 
> This isn't (direct) argument against my proposal. It would be if GC scanning
> void[] is fundamentally "good thing". But in fact I don't think that in this
> case it is such kind of design decision. (There were already proposals to
> change this behavior.)
> 
> But in case of reading external files, the problem is that compiler just *don't
> know* format of imported file. So IMHO the best thing to do is to reflect this
> situation in language, and force user to cast content of file to real type.
> 
> In case there will stay default cast to some type in import it is really
> difficult to justify which default behavior is better. I agree with Bill that
> in most GUI application it would be better to have imported array of bytes. But
> you can also think about DB framework in which external file is used to define
> schema of database (see: U++ framework written in C++). In this case some text
> format is much more natural...
> 


Your argument is right on, but ubyte[] *is* the type that means "I don't know
what the heck this data is, but it's just data, not pointers".  void[] means "I
don't know what the heck this data is, it might even be full of pointers".  

I don't see any way that file that is on disk at *compile time* could contain
pointers that are relevant to the program later on at *run time*.  So ubyte[]
is the proper type.


-- 



More information about the Digitalmars-d-bugs mailing list