1. Borrowing from Perl for namespace
- Posted by Buddy Hyllberg <budmeister1 at JUNO.COM> Jun 11, 1998
- 585 views
Hi all, just wanted to throw out some ideas to consider... In Perl 5.0, which I just started learning not too long ago, there are these things called packages (kinda like classes in C++), and the way you access their methods/data is by using '::', just like in C++. So if you had 2 packages, named 'p_one' & 'p_two', which both had the same scalar named $count, then you could access them both using: $p_one::count $p_two::count without the interpreter or yourself getting confused (or getting an error). In Euphoria, we could make it so that each .e files' routines/data are accessed by using 'include_name::stuff'. That way there could be a bunch of variables by the same name, but they are not confused with each other because of the 'include_name::' prefix. Example:----------------------------- include normal.e include color.e sequence text text = "Hi there" normal::show(1,text) color::show(1,text,"blue","yellow") -------------------------------------- This could also be used for DLLs (which I believe someone else mentioned before?): -------------------------------------- include crypt32.dll sequence text puts(1,"Enter your text to be encrypted") text = gets(0) text = crypt32::encrypt(text,"1234") -------------------------------------- Being able to simply include a DLL like a .e file would be a whole lot easier to do than open_dll() & define_c_whateverw(). It would make the whole DLL interface easier to use, especially for newbies (like moi) ;) ...but would make the core language a little more bloated :( This introduces the use of something like 'use' or Visual Basic's 'with': with crypt32 do encrypt(text,"1234") end with the 'with' construct would eliminate the 'dll/include::' prefix if you plan to use the same include file in a block. Nesting might be a problem though... Of course, if you're big on Euphoria's individuality, then this is not for you, because it would just cause Euphoria to be associated with C++... :) ----->Buddy budmeister1 at juno.com _____________________________________________________________________ You don't need to buy Internet access to use free Internet e-mail. Get completely free e-mail from Juno at http://www.juno.com Or call Juno at (800) 654-JUNO [654-5866]