[DGD] Re: "mixed" question

harte at xs4all.nl harte at xs4all.nl
Sun Jun 7 17:02:19 CEST 1998


Quoting Jason's message from  7 Jun:

| In looking at some code that I wrote some time ago, I've become curious
| about something.  Specifically, what is the difference between (mixed),
| (mixed *), (mixed **), etc.?  Because you can represent a (mixed) value
| with a (mixed **) value and vice versa, there doesn't seem to be any
| difference at all.  I'm sure, however, that there are some
| efficiency/overhead issues to consider.  What are they?  If programmatic
| differences do exist, feel free to clue me in on those as well.

If you really want you can use 'mixed' everywhere, sure.

DGD does however does have type-checking support and if you want to
indicate somewhere that a variable or function returns an array of mixed
values, as upposed to -any- mixed value, then you can do that by using
'mixed *' instead of 'mixed', so that DGD will cause an error if you
try to return an int, float, string, object, or mapping.

This can be a compile-time error if it's obvious in the code itself, or
a runtime error if for instance you get a 'wrong' value from a
call_other().

Hope this helps,

Erwin.





List config page:  http://list.imaginary.com/mailman/listinfo/dgd



More information about the DGD mailing list