Re: Programmatic use for 'type'
- Posted by Adam Weeden <adam_weeden at HOTMAIL.COM> Mar 01, 2000
- 445 views
----- Original Message ----- From: "Mike" <vulcan at WIN.CO.NZ> To: <EUPHORIA at LISTSERV.MUOHIO.EDU> Sent: Wednesday, March 01, 2000 7:10 PM Subject: Re: Programmatic use for 'type' > OK. So my examples are not clear. Well it serves me right for simply copying > the code I was working on. I will try to explain it in generically. > > When a type routine is written (and typecheck) is on then the interpereter > will call the 'type' whenever it finds a parameter with a type of the same > name, ie: > > type CHAR(object x) > .. code etc.. > end type > > function PrintAt(CHAR c) > -- Before any code is executed in this routine the 'c' variable is sent > -- to the CHAR type > -- > -- code etc > end function > > Thus a routine with several parameters will be processed in the same way, > ie: > > function test(CHAR c, FLOAT f, INT i) > -- A call is made to each type routine as is named > -- in the parameter list before any other execution occurs > --void=CHAR(c) > --void=FLOAT(f) > --void=INT(i) > > -- normal code > end function > > Therefore my idea was to convert each var_sent_to_each_type_routine within > the actual type routine and store the result in some accessible variable. > This last variable could be then sent back to the calling routine as a list > of converted elements. > > At the top level a programmer could write a single line of code to convert a > sequence of data that needed it. I suppose one use would be in the situation > where some database info required conversion to a native format but where > the information is currently in text format, ie > > sequence s > s={ > "Brown", > "Charlie", > "555-4567", > "20.0" > "12" > "44 Eastern Park Parade", > "Hampton", > "New jersey", > "", > "" > } > > type STRING etc... > type FLOAT.. > > > function convertFromDatabaseformat( > STRING firstname, > STRING lastname, > TELEPHONENUMBER phonenumber, > FLOAT weight, > INT age, > ADDR addressfirstline, > ADDR addresssecondline, > ADDR addressthirdline, > ADDR addressfourthline, > ADDR addressfifthline > ) > > s=convertFromDatabaseformat( > s[1], s[2], s[3], s[4], s[5], s[6], s[7], s[8], s[9], s[10]) > > --s will now have the data in a native(or whateverelse) format > > I hope this explains what i meant > > yours truly > Mike > > vulcan at win.co.nz > > > -----Original Message----- > From: Bernie Ryan <LockCityData at CS.COM> > To: EUPHORIA at LISTSERV.MUOHIO.EDU <EUPHORIA at LISTSERV.MUOHIO.EDU> > Date: Friday, 25 February 2000 22:36 > Subject: Re: Programmatic use for 'type' > > > >On Fri, 25 Feb 2000 21:05:56 +1300, Mike <vulcan at WIN.CO.NZ> wrote: > > > >>Feedback is welcome. > > > > > >>------------------------------------------------------- > >>-- example 1 > >>-- NMEA.e convert NMEA sentences into Euphoria sequence > >>-- > >>include get.e > >> > >>with type_check -- this line must not be moved or altered > >>without warning > >> > >>object NMEASENTENCE -- this is the public variable > > > > Mike: > > > > I am sorry but I have no idea of what you are trying to explain. > > > > I dont know what NMEA sentences are or what you are trying to do > > > > in your example. It might help if you used an example that is > > > > more generic and not so specialized. I am sure that this information > > > > is valuable. > > > > Thanks Bernie > > > I'm actually working on something like this as addition to my record.e include. It will also support C records. For use in windows programming. No more struggling with pokes. Adam Weeden