1. little question once again
- Posted by Lionel Wong <eljay98 at HOTMAIL.COM> Sep 25, 1999
- 516 views
Can anyone explain what "namespace" is? I've come across it a number of times, but i'm so lost. And here's a Q i've asked before, but the i wasn't satisfied with the answers, so i'll give it another try: what is the term that unifies "variables" and "constants" (in the same sense that "routines" unifies "procedures" and "functions")? In doubt and in the dark, Lionel ______________________________________________________ Get Your Private, Free Email at http://www.hotmail.com
2. Re: little question once again
- Posted by "Lucius L. Hilley III" <lhilley at CDC.NET> Sep 25, 1999
- 501 views
Constants & Variables - Value holders Namespace - only one item may have the name temp. You can have object temp or atom temp or procedure temp among a few other options but you can't have them all at once. Namespace issues arise with different files but the same overall program. Assume I have a program that handles both text mode and graphics mode. The color blue in Text mode is represented with the number 1 but the color blue in True Color graphics is a three color setting. {0, 0, 255} You can have BLUE = 1 or BLUE = {0,0,255} but it can't equal both. Umm, well actually it can. I could have an include file called, mytext.e and another called mygrafix.e I can use BLUE locally in both cases without conflict. This is because of NameSpace. ---mytext.e function BLUE() return 1 end function --------- ---mygrafix.e function BLUE() return {0,0,255} end function --------- We start running into trouble again when we set routines to global. This means they are available outside the file they are in. ---included.e function BLUE() return 5 end function --------- ---program.ex include included.e print(1, BLUE()) --prints "5" --------- --program2.ex include mytext.e include mygrafix.e print(1, BLUE())-- Error BLUE hasn't been declared. --------- In program2.ex you get an error. BLUE hasn't been declared. But you know you declared it. Twice even. once in mygrafix.e and once in mytext.e. Neither is global and therefore don't exist in program2.ex The real problem comes during routine_id(). with routine_id() you can't rename the routine or routine_id() won't find it. During binding the following occurs. Every variable and routine name gets renamed from myvariable and myroutine to Aa and Ab. Extremely meaningless names. This is done for 2 reasons. One reason is to remove conflicts that would occur because of namespace. When you include a file it is complete seperate from the other file. However when you bind or shroud you bring those 2 files together as one big file. NOW, As I said before. program2.ex will fail with an error. When you bind progarm2.ex it would look something like. ----------- function Aa() return 1 end function function Ab() return {0,0,255} end function print(1, Ac()) ----------- This is how Euphoria currently handles the namespacing when making seperate files of one program come together as one program file. The problem arises in routine_id() because -clear_routines() is required and would force routines to retain their names. ----------- function BLUE() return 1 end function function BLUE() return {0,0,255} end function print(1, BLUE()) ----------- The above code obviously shows the attempt to redifine BLUE() Lucius L. Hilley III lhilley at cdc.net lucius at ComputerCafeUSA.com +----------+--------------+--------------+----------+ | Hollow | ICQ: 9638898 | AIM: LLHIII | Computer | | Horse +--------------+--------------+ Cafe' | | Software | http://www.cdc.net/~lhilley | USA | +----------+-------+---------------------+----------+ | http://www.ComputerCafeUSA.com | +--------------------------------+ ----- Original Message ----- From: Lionel Wong <eljay98 at HOTMAIL.COM> To: <EUPHORIA at LISTSERV.MUOHIO.EDU> Sent: Friday, September 24, 1999 11:07 PM Subject: little question once again > ---------------------- Information from the mail header ----------------------- > Sender: Euphoria Programming for MS-DOS <EUPHORIA at LISTSERV.MUOHIO.EDU> > Poster: Lionel Wong <eljay98 at HOTMAIL.COM> > Subject: little question once again > -------------------------------------------------------------------------- ----- > > Can anyone explain what "namespace" is? I've come across it a number of > times, but i'm so lost. > > And here's a Q i've asked before, but the i wasn't satisfied with the > answers, so i'll give it another try: what is the term that unifies > "variables" and "constants" (in the same sense that "routines" unifies > "procedures" and "functions")? > > In doubt and in the dark, > Lionel > > ______________________________________________________ > Get Your Private, Free Email at http://www.hotmail.com >
3. Re: little question once again
- Posted by Tracy Tees <tracytees at TELSTRA.EASYMAIL.COM.AU> Sep 25, 1999
- 486 views
- Last edited Sep 26, 1999
Re Lionel's question for a term to unify constants & variables: I would use the word "Values". ie a constant is a permanent value, and a variable is a changeable one. Tracy.
4. Re: little question once again
- Posted by Bernie Ryan <bwryan at PCOM.NET> Sep 25, 1999
- 481 views
On Sat, 25 Sep 1999 03:07:06 GMT, Lionel Wong <eljay98 at HOTMAIL.COM> wrote: >Can anyone explain what "namespace" is? I've come across it a number of >times, but i'm so lost. NAMESPACE defines the scope of the variables, functions, procedures and etc. In C++ a NAME is assigned to a section of your program and the data and routines in that section is only made visible ( in SCOPE ) to the rest of the program when you use that assigned name to refer to the data and routines in that NAMESPACE. >"variables" and "constants" (in the same sense that "routines" unifies >"procedures" and "functions")? constants and variables are called VARIABLES The word constant is just a modifier to tell the compiler that a variable's value can NOT be changed by the program during run-time. Bernie
5. Re: little question once again
- Posted by jiri babor <jbabor at PARADISE.NET.NZ> Sep 26, 1999
- 483 views
Lionel, Variables and constants are labeled data *containers*. In a sense constants are just handicapped variables with a whimsical restriction imposed on them at birth: they are incapable of change through their entire lifespan. As Bernie already suggested, correctly, namespace is the *scope* of various labels: it defines their accessibility (visibility) within program environment. jiri
6. Re: little question once again
- Posted by Lionel Wong <eljay98 at HOTMAIL.COM> Sep 26, 1999
- 500 views
> constants and variables are called VARIABLES Unfortunately, Bernie, if a constant is a variable then it's not constant anymore. And if a variable is a constant then it's not variable anymore. I tried to think so before, but it's a paradox, cancelling itself in truth. Computer terms are paradoxical puns. =) Thx anyway, Lionel. ______________________________________________________ Get Your Private, Free Email at http://www.hotmail.com
7. Re: little question once again
- Posted by Bernie Ryan <bwryan at PCOM.NET> Sep 25, 1999
- 487 views
- Last edited Sep 26, 1999
On Sun, 26 Sep 1999 02:18:04 GMT, Lionel Wong <eljay98 at HOTMAIL.COM> wrote: >> constants and variables are called VARIABLES > >Unfortunately, Bernie, if a constant is a variable then it's not constant >anymore. And if a variable is a constant then it's not variable anymore. > >I tried to think so before, but it's a paradox, cancelling itself in truth. >Computer terms are paradoxical puns. =) > >Thx anyway, >Lionel. > >______________________________________________________ >Get Your Private, Free Email at http://www.hotmail.com Linonel You still do not understand what I mean. A variable is the name of the location for storing data in memory. You can define a variable to contain a constant value. You can define a variable to contain a changing value. Both are called variables. Bernie
8. Re: little question once again
- Posted by Greg Phillips <i.shoot at REDNECKS.COM> Sep 26, 1999
- 486 views
Bernie, You've got the right idea about what variables and constants *are*, but they aren't both called variables. Their names are quite literal: variable \Va"ri*a*ble\, n. 1. That which is variable; that which varies, or is subject to change. constant \Con"stant\, n. 1. That which is not subject to change; that which is invariable. I think 'values' or even 'data holders' is more accurate than 'variables' to describe them. Greg Phillips Bernie Ryan wrote: > On Sun, 26 Sep 1999 02:18:04 GMT, Lionel Wong <eljay98 at HOTMAIL.COM> wrote: > > >> constants and variables are called VARIABLES > > > >Unfortunately, Bernie, if a constant is a variable then it's not constant > >anymore. And if a variable is a constant then it's not variable anymore. > > > >I tried to think so before, but it's a paradox, cancelling itself in truth. > >Computer terms are paradoxical puns. =) > > > >Thx anyway, > >Lionel. > > > >______________________________________________________ > >Get Your Private, Free Email at http://www.hotmail.com > > Linonel > You still do not understand what I mean. > A variable is the name of the location for storing data in memory. > You can define a variable to contain a constant value. > You can define a variable to contain a changing value. > Both are called variables. > Bernie -- The Euphoria CD Project: "Only $9.95, and comes with this juicer absolutely free!" http://www.redrival.com/euphoria/doslinux.html
9. Re: little question once again
- Posted by Irv Mullins <irv at ELLIJAY.COM> Sep 25, 1999
- 485 views
- Last edited Sep 26, 1999
On Sat, 25 Sep 1999, you wrote: > > constants and variables are called VARIABLES > > Unfortunately, Bernie, if a constant is a variable then it's not constant > anymore. And if a variable is a constant then it's not variable anymore. But, a constant IS variable. It can only be varied by the programmer prior to the run (or the compile) example: constant pi = 3.0 -- that's wrong, but I can change it! Irv
10. Re: little question once again
- Posted by Everett Williams <rett at GVTC.COM> Sep 26, 1999
- 491 views
>Subject: Re: little question once again > Date: Sat, 25 Sep 1999 23:24:09 -0400 > From: Bernie Ryan <bwryan at PCOM.NET> > > On Sun, 26 Sep 1999 02:18:04 GMT, Lionel Wong <eljay98 at HOTMAIL.COM> wrote: > >>> constants and variables are called VARIABLES >> >>Unfortunately, Bernie, if a constant is a variable then it's not constant >>anymore. And if a variable is a constant then it's not variable anymore. >> >>I tried to think so before, but it's a paradox, cancelling itself in truth. >>Computer terms are paradoxical puns. =) >> >>Thx anyway, >>Lionel. >> >>______________________________________________________ >>Get Your Private, Free Email at http://www.hotmail.com > > Linonel > You still do not understand what I mean. > A variable is the name of the location for storing data in memory. > You can define a variable to contain a constant value. > You can define a variable to contain a changing value. > Both are called variables. > Bernie I am a new person on this mail list(as will seem obvious by the fact that I posted this message originally in the wrong place, because I have been a digest only person up to now), but have written to Robert in the past on this very subject. The important point about"variable" and "constant" is that in Euphoria, a constant is a very special animal. It is forced to global scope by definition, and by the requirement that it be found in the main line of the program. I can only assume, that constants are only handled once by the interpreter, put into a special non-dynamic area at the beginning of the name table and never revisited except for reference. I also, suspect that in the interpretation process, they are substituted either on a parse pass or with the "literals" in a statement. Speaking of that, I believe that "literal" may be a term that all of you have been searching for. All atoms that are not written as variables are literals by usage in many other languages. The logical treatment of all atoms as numbers in Euphoria gets rid of a confusion found in most languages at the expense of introducing a confusion in the minds of most people not working as programmers. The treatment of constants is exactly like that of literals within the language. It is merely a bow to the symbolic way in which humans process information. That is why it "logically" belongs in a parsing pass of a statement rather than in dynamic variable resolution. On Sat, 25 Sep 1999 22:37:06 -0400, Irv Mullins <irv at ELLIJAY.COM> wrote: >On Sat, 25 Sep 1999, you wrote: >> > constants and variables are called VARIABLES >> >> Unfortunately, Bernie, if a constant is a variable then it's not constant >> anymore. And if a variable is a constant then it's not variable anymore. > >But, a constant IS variable. It can only be varied by the programmer prior to >the run (or the compile) >example: >constant pi = 3.0 -- that's wrong, but I can change it! > >Irv And the idea that a constant is a variable because it can be changed by the programmer should be an obvious logical dead-end...anything can be changed by the programmer...then the whole program is a variable by that thinking. Logically, that is so, but a real stretch for this discussion. Everett L.(Rett) Williams rett at gvtc.com Everett L.(Rett) Williams rett at gvtc.com
11. Re: little question once again
- Posted by Craig Gilbert <bytebrain at MINDSPRING.COM> Sep 26, 1999
- 501 views
On 9/25/99 10:37:06 PM, Irv Mullins said: >On Sat, 25 Sep 1999, you wrote: >> > constants and variables are called VARIABLES >> >> Unfortunately, Bernie, if a constant is a variable then it's not constant >> anymore. And if a variable is a constant then it's not variable anymore. > >But, a constant IS variable. It can only be varied by the programmer prior to >the run (or the compile) >example: >constant pi = 3.0 -- that's wrong, but I can change it! > >Irv I'm not sure that is a valid line of reasoning in this context. After all, I can change *anything* in my program before run time; that doesn't mean I want to call every component of the program a variable. I've always assumed that the names we give to the pieces of a program get their meaning from the way they behave when the program is actually acting as a program, i.e. being executed. Otherwise they are just characters in a text file, anyway. Of course, I am just assuming that based on the way I've always treated those 'pieces'. Is that incorrect? Craig --------------------------------------------------------------- We used to think that if we knew one, we knew two, because one and one are two. We are finding that we must learn a great deal more about `and'. --Sir Arthur Eddington
12. Re: little question once again
- Posted by Bernie Ryan <bwryan at PCOM.NET> Sep 26, 1999
- 507 views
On Sat, 25 Sep 1999 22:37:06 -0400, Irv Mullins <irv at ELLIJAY.COM> wrote: >constant pi = 3.0 -- that's wrong, but I can change it! > >Irv Irv That is true in Euphoria because Euphoria doesn't have real constants. In C or C++ when you try to change a constant's value you will get a run-time error. In C++ you can only explicitly override the constant by using the const_cast operator. Bernie
13. Re: little question once again
- Posted by Irv Mullins <irv at ELLIJAY.COM> Sep 26, 1999
- 476 views
On Sun, 26 Sep 1999, you wrote: > On Sat, 25 Sep 1999 22:37:06 -0400, Irv Mullins <irv at ELLIJAY.COM> wrote: > >constant pi = 3.0 -- that's wrong, but I can change it! > > > That is true in Euphoria because Euphoria doesn't have real constants. Bzzt! Sorry, that's the wrong answer. Euphoria will halt with this error message: may not change the value of a constant pi = 3 > In C or C++ when you try to change a constant's value you will get a > run-time error. In C++ you can only explicitly override the constant by > using the const_cast operator. Bzzt! again. (sort of) The whole purpose of constants is that they cannot be programatically changed. A C++ constant is just a variable that's "hard" to change. Pascal (Borland flavor) lets you change the value of constants even easier, but at least the documentation says to thinkof them as "initialized variables". Irv
14. Re: little question once again
- Posted by Irv Mullins <irv at ELLIJAY.COM> Sep 26, 1999
- 467 views
On Sun, 26 Sep 1999, Everett Williams wrote: > >Subject: Re: little question once again > And the idea that a constant is a variable because it can be changed by the > programmer should be an obvious logical dead-end...anything can be changed > by the programmer...then the whole program is a variable by that thinking. > Logically, that is so, but a real stretch for this discussion. In some languages I can change the meaning of symbols such as <= , not , or + Not so in Euphoria. I can't override the reserved words such as for, do, end, either. I can override identifiers such as printf (if I wish to make my program more confusing) In fact, the only things I can change in my program (without breaking someone else's work) are the flow of the logic, the value of constants and literals, and the names of functions and procedures. All these are lumped together under the term "identifiers", which also includes such things as types, record field names, and even program / module / unit names, in languages which offer those things. Regards, Irv
15. Re: little question once again
- Posted by Mike Hurley <mikehurley2 at NETZERO.NET> Sep 26, 1999
- 487 views
Does it really matter? Mike Hurley ________________________________________________________ NetZero - We believe in a FREE Internet. Shouldn't you? Get your FREE Internet Access and Email at http://www.netzero.net/download/index.html
16. Re: little question once again
- Posted by Everett Williams <rett at GVTC.COM> Sep 26, 1999
- 481 views
Mike Hurley wrote: >Does it really matter? > Whether we have a word for constants and variables, probably not...but what does matter is that the handling of constants and variables in Euphoria is key to the growth of the language. Mr. Hilley's discussion of namespaces points to an issue that will control the future uses and growth of Euphoria. Until we, the user community, get a way to easily control the use of constants and variables in large multi-module, multi-include programs cleanly and logically, Euphoria will be limited in scope far more than it's sort-of interpreted status would impose. Euphoria appears to be fast enough to accomplish most standard programming needs and allows access to sufficient other resources such as compiled or assembled code to fill in when necessary. Right now, it takes way too much effort to make multiple includes of similar natures get along. Talvitie's problems where she can use Neil OR Exotica, but not select the best of both are a good example. As has been discussed before, some kind of prefixing would solve many of these problems and would make the process that bind accomplishes explicit. One way to accomplish this would be through named includes, the name becoming the prefix for reference to all routines and variables in that include that are global in scope. It would also become an internal tag for the interpreter to use when distinguishing conflicts. Just seems too simple and logical not to do. Everett l.(Rett) Williams rett at gvtc.com
17. Re: little question once again
- Posted by Irv Mullins <irv at ELLIJAY.COM> Sep 26, 1999
- 503 views
- Last edited Sep 27, 1999
On Sun, 26 Sep 1999, Everett l.(Rett) Williams wrote: > what > does matter is that the handling of constants and variables in Euphoria is > key to the growth of the language. Mr. Hilley's discussion of namespaces > points to an issue that will control the future uses and growth of Euphoria. > Until we, the user community, get a way to easily control the use of > constants and variables in large multi-module, multi-include programs > cleanly and logically, Euphoria will be limited in scope far more than it's > sort-of interpreted status would impose. Euphoria appears to be fast enough > to accomplish most standard programming needs and allows access to > sufficient other resources such as compiled or assembled code to fill in > when necessary. Right now, it takes way too much effort to make multiple > includes of similar natures get along. Talvitie's problems where she can use > Neil OR Exotica, but not select the best of both are a good example. > > As has been discussed before, some kind of prefixing would solve many of > these problems and would make the process that bind accomplishes explicit. > One way to accomplish this would be through named includes, the name > becoming the prefix for reference to all routines and variables in that > include that are global in scope. It would also become an internal tag for > the interpreter to use when distinguishing conflicts. Just seems too simple > and logical not to do. Rob has promised that the namespace problem will next on his list of things to do. I have no idea how he will accomplish this, but I personally prefer the method you suggest - using the include file name as the prefix, eg: foo.position(3.5) bar.position(5,5) which leads to more of an object oriented approach to building programs. Not a bad thing IMHO. Regards, Irv
18. Re: little question once again
- Posted by Everett Williams <rett at GVTC.COM> Sep 26, 1999
- 462 views
- Last edited Sep 27, 1999
On Sun, 26 Sep 1999 20:55:20 -0400, Irv Mullins <irv at ELLIJAY.COM> wrote: Irv wrote: >Rob has promised that the namespace problem will next on his list of >things to do. I have no idea how he will accomplish this, but I personally >prefer the method you suggest - using the include file name as the prefix, eg: >foo.position(3.5) bar.position(5,5) which leads to more of an object oriented >approach to building programs. Not a bad thing IMHO. > >Regards, >Irv Irv, Thanks for the info and support. Only one minor quibble. I'm not sure that I ever want to get to instantiation, methods, and all that other fun associated with object-oriented programming. I would just like to allow this beautiful little procedural language to take on just enough extensions to allow clean and easy usage of pre-existing code and libraries. Objects are like Lil' Abners schmoos(if any of you are old enough to remember those :); they multiply everywhere, they are many times of completely unknown and unknowable content, and they encourage laziness(in this case in programming). Everett L.(Rett) Williams rett at gvtc.com
19. Re: little question once again
- Posted by Lewis Townsend <keroltarr at HOTMAIL.COM> Sep 27, 1999
- 499 views
Hello, Tracy Tees wrote: >Re Lionel's question for a term to unify constants & variables: >I would use the word "Values". ie a constant is a permanent value, and a >variable is a changeable one. >Tracy. > I call them "Named values" because a value can be: 5 or 79.32 or {1, 2, 3} as well as the the name given to such values. -- Illustration code sequence msg msg = "Hello world" puts (1, msg) -- End Illustration code In this example, in the call to puts(), "1" is a value but "msg" is a named value. Does this make sense? later, Lewis Townsend ______________________________________________________ Get Your Private, Free Email at http://www.hotmail.com
20. Re: little question once again
- Posted by Irv Mullins <irv at ELLIJAY.COM> Sep 27, 1999
- 478 views
On Mon, 27 Sep 1999, LT wrote: > Hello, > > Tracy Tees wrote: > > >Re Lionel's question for a term to unify constants & variables: > >I would use the word "Values". ie a constant is a permanent value, and a > >variable is a changeable one. > >Tracy. > > OK, I finally looked this up in some of my programming books. Variables and constants are lumped together under the term "DATA" (surprise!) This explains BASIC's use of statements such as DATA 4,5,7 which are the equivalent of constants, since they are fixed at write time. And obviously variables, once intiialized, are also data, which can change during the run. Procedures and functions are not data. Operators are not data. Literals are unnamed constants - so they may qualify as data, I dunno. Irv
21. Re: little question once again
- Posted by Lionel Wong <eljay98 at HOTMAIL.COM> Sep 30, 1999
- 481 views
> >Unfortunately, Bernie, if a constant is a variable then it's not constant > >anymore. And if a variable is a constant then it's not variable anymore. > > > >I tried to think so before, but it's a paradox, cancelling itself in >truth. > >Computer terms are paradoxical puns. =) > > > >Thx anyway, > >Lionel. > > > >Lionel > You still do not understand what I mean. > A variable is the name of the location for storing data in memory. > You can define a variable to contain a constant value. > You can define a variable to contain a changing value. > Both are called variables. >Bernie I know exactly what you meant, Bernie. I hope you noticed the literal meaning, however. The paradox, though being true, was also meant to be a joke. Laugh, you guys. Lionel. ______________________________________________________ Get Your Private, Free Email at http://www.hotmail.com