Re: My Lobbying
- Posted by Irv Mullins <irv at ELLIJAY.COM> Sep 06, 2000
- 471 views
----- Original Message ----- From: Derek Parnell <dparnell at BIGPOND.NET.AU> To: <EUPHORIA at LISTSERV.MUOHIO.EDU> Sent: Wednesday, September 06, 2000 4:11 PM Subject: Re: My Lobbying \ > I was thinking more along the lines of ... > > if not defined True then > constant True = 1 > end if > if not defined False then > constant False = 0 > end if > > if not defined trim then > function trim(sequence s) > . > . > . > end function > end if > > etc... I see. That is a problem I haven't run across. Generally, I just go ahead and use a constant or variable, and if it isn't defined somewhere, I'll get an error the first time I try to run the program. Then I can define it as I want, without worrying about breaking someone else's code. On the other hand, if I try to define TRUE, even though it has already been defined elsewhere, I'll get a message telling me this. That approach seems completely satisfactory, and reduces the possibility of introducing new and puzzling bugs. Suppose I define TRUE='Y' somewhere, and you use it, expecting it to be = 1? > As many commonly required names (constants and functions) are missing from > standard Euphoria, people have a tendency to re-invent them in the various > generic include files. But not always. The namespace resolution should be > one way of overcoming this, however it could still mean that unnecessary > items get defined. Unnecessary, because a perfectly good definition might > already exist, but because I can't be sure I define it again anyway, then > use my definition and ignore the earlier one. But, as things stand, you can't define something again, if it already exists. You'll be warned if you try, and you _cannot_ "ignore the earlier one". If, on the other hand, it doesn't exist, then you have little choice but to write the code, or find a library which already contains it. So this is, as far as I can tell, a solution in search of a problem. While it's true that there are a lot fewer required names in Euphoria than in other languages, that is a "good thing". Quick, list all the string conversion functions in C. Bet you miss a few. Now, cross off your list all those that can't be duplicated by combining two or three Euphoria commands. Not many left, are there? Irv