Re: Using include and namespaces
- Posted by 10963508 at europeonline.com Aug 16, 2002
- 625 views
----- Original Message ----- From: <jbrown105 at speedymail.org> To: "EUforum" <EUforum at topica.com> Subject: Re: Using include and namespaces > > On 0, 10963508 at europeonline.com wrote: > > > > > > ----- Original Message ----- > > From: <OthelloVivaldi at hotmail.com> > > > > > My current solution is therefore to use the include ... as feature. > > > > > > For example, to implement the typical a* routine, you will need > > > two heaps, which are often given the names 'open' and 'close'. > > > So the question is: what do you think about the following: > > > > > > include heap.e as Open > > > include heap.e as Close > > > > > > Open:push(X) > > > Close:push(Y) > > > X = Open:pop() > > > Y = Close:pop() > > > > > > Would you recommend this kind of programming style? > > > Is there some horrible way this can backfire or otherwise > > > turn out to be a member of the set of bad things? > > > > > > If this would work in Euphoria I would be very happy, but it doesn't. Second > > include file is just ignored. (Or does it?? :\) > > This is my number one wish item for any Euphoria feature (second are > > structures). That each include file has instance in memory, like a class. > > Now for every library which will have more than one object in program you > > have to keep id for each object of library and have global sequences in > > library file and access properties of objects from those global sequences > > and with id of object. This slows down coding time, clarity of code is > > reduced > > and also speed of program is slower I > > imagine. > > > > This is a very interesting use of namespaces. I'll modify my namespace > parser > to support this type of "classes". (My parser rewrites all include > statements, > replacing them with direct code, so Eu's own version of include is > ignored.) If you're going to do it then do it that way that you can create as many objects as you want in a loop, I don't know how exactly should it work, something like this: include circle.e as CIRCLE sequence one_object CIRCLE one_object for i = 1 to 100 do one_object = new (CIRCLE) objects = append (objects, one_object) end for