1. Question about includes
- Posted by timmy <tim781 at PACBELL.NET> Jan 26, 2001
- 490 views
Hi, I'm writting to ask how euphoria handles includes. I'm writting a win32lib program and want to make part of the menus and then the rest based on text files. The problem is that I can't put the global procedures in an include file, because it says some of the varibles have'nt been declared, even though I declared them and set them in the main .exw and put the neccessary include statement all the way down where I put WinMain. One of the menus is a song list which the users can edit. It takes alot of code and I also have other menus that can be edited. My main .exw is going to look like a gigantic Basic program if I can't break them up. Has anyone run into this problem? Is there a "best way" for writting win32lib programs? ..thanks timmy :)
2. Re: Question about includes
- Posted by Derek Parnell <dparnell at BIGPOND.NET.AU> Jan 27, 2001
- 482 views
Hi timmy, Currently Euphoria, unlike many other languages, has been written as a single pass interpreter. This means that you can only refer to a name (variable, constant, procedure or function) if that name occurs earlier in the text of your program. You cannot refer to something that occurs later on in the text of the program code. It doesn't matter if its global or not. The "global" keyword just means that if you define a name inside an include file, that code after the include file can "see" the name, otherwise only code in the include file can see it. This is a bothersome limitation in Euphoria for a lot of people and to get around it we have to do all sorts of (frequent!) code rearranging. In your case, using global procedures inside an include file, means that the include statement must occur early in your main file so that code after it can see the procedure. It sounds like you have to move the include statement away from the WinMain() call to earlier in your code. The difficulty is that if any code inside the include file references variables or routines in your main file, your must ensure that the include statement is after all those definitions. Another problem that might arise is if two or more routines refer to each other. To get around this issue, you must define some new variables before these interdependant routines and set these to the routine_id of the approriate routines after the routines. Then instead of just calling the routines you have to use the special call_func or call_proc statements. <soapbox> I just hope that one day, RDS can see what a waste of people's time this continuous messing around with reorganising lines of code, and adding superfluous (global) definitions, can be. A program, such as an interpreter can do it much faster, in real-time, than we can. The larger the program, the more probability one will have to change code lines around. This is a negative reinforcement to writing professional applications. Euphoria has special built-in language constructs that must be used as workarounds to solve the forward-referencing problem, because its against RDS's view of perfection. RDS sees the current way of doing things as more elegant, simple and ideal. I believe it that this philosophy is contrary to most respected theories on code developement and human thinking. Refer to Weinberg, Gilb, McConnell, Dupre, MacGuire, Yourdan, de Bono, Booch, Wiegers, Gause, ... <\soapbox> ------ Derek Parnell Melbourne, Australia (Vote [1] The Cheshire Cat for Internet Mascot) ----- Original Message ----- From: "timmy" <tim781 at PACBELL.NET> To: <EUPHORIA at LISTSERV.MUOHIO.EDU> Sent: Saturday, January 27, 2001 6:43 AM Subject: Question about includes > Hi, > > I'm writting to ask how euphoria > handles includes. I'm writting > a win32lib program and want > to make part of the menus and then > the rest based on text files. The > problem is that I can't put the global procedures > in an include file, because it says > some of the varibles have'nt been > declared, even though I declared them > and set them in the main .exw and put the > neccessary include statement all the way down > where I put WinMain. > > One of the menus is a song list which > the users can edit. It takes alot of code > and I also have other menus that can be edited. > My main .exw is going to look like a > gigantic Basic program if I can't break them up. > > Has anyone run into this problem? Is there > a "best way" for writting win32lib programs? > > ...thanks > > timmy :)
3. Re: Question about includes
- Posted by George Henry <ghenryca at lycos.com> Jan 26, 2001
- 485 views
- Last edited Jan 27, 2001
--=_-=_-NGLEHKDCBPOELAAA Content-Language: en Content-Length: 997 Hello, everyone. I said I would try to work up a demo of my idea concerning portions of a program being unshrouded/unbound and modifiable by users, or by the program itself. After some rather indelicate surgery, here it is. I have tested it and I believe it illustrates the concept adequately. There are two files, demo.exw and demo.ini. The program creates two windows, which can be docked together in a couple of different ways, or they can be moved independently. By clicking the "Save and Exit" button, you can save the current docking option and the current window positions in demo.ini, in the form of code that will be run the next time the program is started up. Comments are purposely minimal, and focused on the idea I am trying to illustrate. You will need Win32Lib to run the program; I am using version 0.55. I will try to answer all pertinent questions. Thanks, George Get your small business started at Lycos Small Business at http://www.lycos.com/business/mail.html --=_-=_-NGLEHKDCBPOELAAA Content-Length: 2815 bW8uZXh3UEsFBgAAAAACAAIAbAAAAJ4HAAAAAA== --=_-=_-NGLEHKDCBPOELAAA--
4. Re: Question about includes
- Posted by George Henry <ghenryca at lycos.com> Jan 26, 2001
- 485 views
- Last edited Jan 27, 2001
On Fri, 26 Jan 2001 11:43:19 timmy wrote: >I'm writting >a win32lib program and want >to make part of the menus and then >the rest based on text files. .. >One of the menus is a song list which >the users can edit. It takes alot of code >and I also have other menus that can be edited. While I understand the need to write my code in Euphorian sequence (order) rather than "George's train of thought" sequence or any other logical/conceivable sequence; and I understand the need to declare anything that I want to be visible in any other file as "global" - and I DO find it a royal pain to have to religiously follow the Euphorian sequence, as per Derek Parnell's "soapbox" (in another reply to this message, sorry I can't quote everything that contributes to my thinking): I also am writing a program wherein it is very desirable, in fact as author and designer of the program I deem it a "requirement," for users to be able to edit limited portions of the code. Ultimately, I aim to shroud and bind the program, at which point I will encounter the need to essentially embed a Euphoria interpreter into my program - which I submit, is insanity. I very earnestly believe there is an imperative need to allow limited user programming via unshrouded, unbound Euphoria source files, to be included with an otherwise shrouded and bound program. I realize this would be non-trivial to implement, however it should be manageable provided that shroud and bind are told which entities (variables and routines) the user code will be allowed to access. The specified identifiers, of course, could not be shrouded. ("Variable and routine names are converted into short meaningless names" - with specified exceptions, I propose.) Euphoria's syntax is sufficiently simple that it is not unreasonable to expect users, with a little guidance and documentation, to be able to assign values to variables and make simple routine calls; perhaps even to write simple routines and "install" them via facilities provided for the purpose. (I mean, facilities that the originators of large and complex programs would provide to the users.) Don't want your users cobbling up code using Notepad or their other text editor of choice? (Hmm, this COULD be a way of initiating zillions of new users into the Joys of Euphoria. When they see how EASY and SIMPLE it is to write limited snippets of code, they might become interested in learning more....) Fine and dandy, and I prolly agree with you, although I think it would be unbearably cool and *involving* to at least let them read and (believe they) understand bits of the code that controls the program they're using - without revealing any vital secrets about the guts, of course. So let the users do their "programming" via dialogs or whatever cool "visual programming system" you want to set up, then have your program write the desired code, to be interpreted the next time the program is invoked - or perhaps even more immediately, using the chaining facility ("program overlays") that Mike Sabal previously suggested. I will see if I can work up a little demo (similar to what my program is already doing) to powerfully illustrate the value of all this. Best regards, George Get your small business started at Lycos Small Business at http://www.lycos.com/business/mail.html
5. Re: Question about includes
- Posted by "Cuny, David at DSS" <David.Cuny at DSS.CA.GOV> Jan 29, 2001
- 491 views
Matthew Lewis wrote: > I haven't worked with Ox at all, but has anyone > tried converting the output to a scripting engine? That's pretty much what Py is, but you knew that. > And has anyone written an Eu clone (minus the Py > enhancements)? Well, the Euphoria to Java translator is *sort of* a Eu clone. The grammar is (more or less) capable reading most Euphoria programs. I don't see any reason you couldn't shoehorn the Ox frontend onto the Eu backend. -- David Cuny