Re: Include system
- Posted by ags <eu at 531pi.co.nz> Dec 31, 2006
- 1102 views
CChris wrote: > > ags wrote: > > > > include get.e -- possibly *my* get.e > > include /get.e -- *the* get.e > > include /std/math/complex.e > > include /net/http/useragent/simple.e :) > > include /user/b.ryan/wmotor.ew > > > > The issue here is what if you really do want something relative to the root > > folder on the filesystem? Well, should that actually be allowed? > > Yes, because you may have several versions on your HD and want to benchmark > > or otherwise compare something using each of them in turn. > > Why not just quote any absolute path? > }}} <eucode> > include get.e -- possibly mine > include /get.e -- no relative search > include "/user/alfred/get.e" -- use this path verbatim > include /"my own get.e" -- disable relative search even with spaces in the > -- name under Windows (and others?) > include "./my own get.e"" -- use this file from the current directory > include "my own get.e" -- search for it, including in the current directory. > </eucode> {{{ Yeah, that looks good. But I was thinking of it from a security point of view. What happens in the interpreter when you include "/etc/passwd" ? (People are going to want to know these things). > > It would be easy for the interpreter, if platform()=DOS, to convert forward > > slashes to backslashes. I understand that all Windows versions accept both. > What about Macs? Perhaps not even needed. I think Mac is :: and no it won't be needed if there is no OS9 port. > > > include /math/bignum.e -- the current version > > include /gfx/drivers/framebuf.e =9.3.01 -- only this version > > include /database/odbc.ew >=4.2 -- greater or = to this version > > include /win32/winsock.ew <2.0.1 -- any version less than 2.0.1? > > > > Interesting, but possibly complex. This is because you'll have to specify > somehow what the interpreter is to do if it cant find the right version, or > > what's the update policy. Yeah. I was thinking when I suggested that that it that it might be difficult. But if the definition of "current version" really just means what is in the include folder (with the highest version number) will get used. I started that post with "there is no need to make it complex" and suggest something even more complex. But ya get that... > * = and < are easy: just fail if available file isn't here. > * As for ">=" with a net path, you cant ask the program to check always for > the > latest version: it would make the load time unacceptable. You may want a > "with update" to enable remote version check. > * Now what about >= when the right version isn't here? You can either issue > a > warning ("You may continue, but a couple things may fail") or just fail. > Perhaps a >>= to request failure on insufficent version available? With with update the programmer codes the behaviour whereas it should really be in the hands of the end user, so some kind of preference of the EU system itself...maybe a default policy of asking before downloading, but also including a large core of includes with the install. > Oh, by the way, how would the interpreter know about file versions? Hehe yeah, that's the kicker. It's easy enough to invent a new standard, but editing every include in the archive would surely suck. And I don't think versioning really works unless you use automated constraint like cvs. I was just throwing that in from Perl and I don't think I've ever taken that feature too seriously before (although I'm sure it's great...). Happy New Year Gary