[DGD]1.1.52

Mikael Lind z94lind at mtek.chalmers.se
Sat Mar 13 12:20:13 CET 1999


On Fri, 12 Mar 1999, Felix A. Croes wrote:

> Frank Schmidt <franks at colargol.tihlde.hist.no> wrote:
> 
> > How about defining a kfun (could with advantage be called 
> > allocate_array):
> >  varargs mixed *allocate(int size, mixed value)
> >
> > instead of having three different functions not really covering all
> > needs (when you want value different from 0, 0.0 and nil or even an 
> > array of strings!). The function would return an array the size of 
> > the first
> > argument with all elements containing values of the second. The 
> > second argument would default to nil naturally.

To me, the proper place for such functionality would be the auto object or
a library object. (I put a similar function in a library object for
generic array functions.)

> I see the various allocate functions as allocating an array with
> elements of a certain type, rather than a certain value.  0, 0.0 and
> nil all represent the "uncreated" values for those types, rather than
> actually meaningful values.
> 
> I agree that having 3 different allocate functions is cumbersome,
> but I'm looking at something like
> 
>     varargs mixed *allocate(int size, int type)
> 
> instead.

This seems more in line with DGD's flexible and minimalistic approach,
although I wouldn't mind using different allocate functions either. 

> Nil tests as false in a truth expression.  You can use the `!'
> operator to invert this:
> 
>     if (nil) { /* don't do this */ }
>     if (!nil) { /* do this */ }
> 
> Nil is supposed to enable stronger typechecking, so I am rather
> surprised to see you suggest that it should be the same as (string) 0
> or (object) 0.  By the way, (string) 0 is the string "0".

On another (but related) subject: will DGD ever support a boolean type? I
would like that very, very much. 

// Mikael

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



More information about the DGD mailing list