require("system").os does not work.
Christoph
> How would I get the OS string (uname)?
>
> require("system").os does not work.
>
Doesn't work for likely the same reason that O_TRUNC doesn't wor.
The names in the structure returned by uname(2) are accessed
with -lffi wrappings.
If the auto generated JS goes AWOL, then the methods break.
73 de Jeff
Is require("system").os part of the ratified spec? If so we'll need to upgrade GPSEE at some point.
At any rate, this should work for you:
const ffi = require("gffi");
const { int, pointer, CFunction, MutableStruct } = ffi;
const uname   = new CFunction(int, "uname", pointer);
const strerror = new CFunction(pointer, "strerror", int);
require("system").__defineGetter__("os", function()
{
 var name = new MutableStruct("struct utsname");
 if (uname(name) == -1)
   throw new Error("Cannot determine OS name (" + strerror(ffi.errno).asString() + ")");
 return name.sysname.asString();
});
> Q: what is CommonJS doing about module dependencies? How reliable?
> is what I'm really asking: "dependency hell" is an occupational hazard.
That is my focus. No dependency hell if using CommonJS Mappings [1] as
implemented in the PINF loader. It is 100% deterministic and you have
exact control of all packages and versions that your program uses.
See: https://github.com/cadorn/ace-extjs (package.json, program.json and
program.packages.json)
Christoph
Q: what is CommonJS doing about module dependencies? How reliable?is what I'm really asking: "dependency hell" is an occupational hazard.
I'm gonna trademark "dependency hell" so that I can look Debian devel'sand RPM lusers straight in the eye and say with a poker face:The term "dependency hell" is tradmarked by "Wraptastic LLC" andapproate symbols MUST be used.And then I'm gonna run like hell for safety … ;-)Â
On 21 September 2011 14:22, Jeff Johnson <n3...@mac.com> wrote:Q: what is CommonJS doing about module dependencies? How reliable?is what I'm really asking: "dependency hell" is an occupational hazard.
The current state of Modules/1.1.1 says that module A depends on module B only if and only when module A invokes require(B).
Upon first invocation, if B cannot be resolved, the require call must throw an exception. It is not defined whether it is allowed to succeed on a subsequent call.
In Modules/2.0-draft8, which is not an official standard, module dependencies are declared along with the module. Web-browser based module loaders will resolve the dependencies (but not initialize the module) before the application starts, to avoid blocking calls. The behaviour in /1.1.1 is also permitted. It is allowable, but not required, for a Modules/2.0-draft8 system to resolve a module which was not explicitly named in the module dependencies.Â
Â
I'm gonna trademark "dependency hell" so that I can look Debian devel'sand RPM lusers straight in the eye and say with a poker face:The term "dependency hell" is tradmarked by "Wraptastic LLC" andapproate symbols MUST be used.And then I'm gonna run like hell for safety … ;-)Â
HA!
BTW, dependency hell is more likely - I think - to happen between packages than between modules. Packages are collections of modules. In this context, modules tend to be more like C programs and object files, whereas packages tend to be more like solibs. GPSEE does not support packages natively, but Christoph's PINF loader adds that capability.
Â
On Sep 21, 2011, at 2:47 PM, Wes Garland wrote:On 21 September 2011 14:22, Jeff Johnson <n3...@mac.com> wrote:Q: what is CommonJS doing about module dependencies? How reliable?is what I'm really asking: "dependency hell" is an occupational hazard.
The current state of Modules/1.1.1 says that module A depends on module B only if and only when module A invokes require(B).And so delayed and run-time and dependent and "soft" dependency like perl.Here's a couple of thoughts for ways to avoid "dependency hell".1) even if you wish to delay the loading and resource consumption until
actually needed, adding a "hard" dependency�mode where dependencies
are registered early at one point in time (but marked unneeded or something)likely helps QA and more. Its tricky QA with "soft" lazily loaded depndency chains,some KISS functionality (I'd do --enable-hard-deps or similar) helps buildmommas doing distro QA.
Upon first invocation, if B cannot be resolved, the require call must throw an exception.� It is not defined whether it is allowed to succeed on a subsequent call.
Everyone gotta be doing the exceptions, sigh. But with an early/hard dependency registration
you might be able to displatya reasonable error message etc in the exception handler(and perhaps warn early if no resolution seems viable even though you MUSTevaluate later at specific instance in time for "soft" deps. There's also the possibilityof greedy/asynchronous downloading (not that JS modules/packages will ever be 100'sMb's but its a nice touch anyways).
In Modules/2.0-draft8, which is not an official standard, module dependencies are declared along with the module. Web-browser based module loaders will resolve the dependencies (but not initialize the module) before the application starts, to avoid blocking calls.� The behaviour in /1.1.1 is also permitted.� It is allowable, but not required, for a Modules/2.0-draft8 system to resolve a module which was not explicitly named in the module dependencies.�
�
Good: Modules 2.0 starts to sound what I've just described.
The other thing to start think about is a way to automate the dependency chainswithout the need for specific overloading of requires("foo") as alsoa dependency marker.I point you at/bin/bash --rpm-requires foo.shwhich basically drills into the shell parser (because writing a separate shell parseris a hugely complex task) and finds every occurence oftokens in an executable context and emits those, but doesn't execute anything whatsoever.What I'm suggesting is something similar for gar(1): a means to parse *.jsand pull out every token that indicates an external need: even if all yourare doing si applying a pattern to pull "foo" out of
�requires("foo") �
its useful (imho) to be able to extract all script pre-requisites efficiently.
BTW, dependency hell is more likely - I think - to happen between packages than between modules.� Packages are collections of modules.� In this context, modules tend to be more like C programs and object files, whereas packages tend to be more like solibs.� GPSEE does not support packages natively, but Christoph's PINF loader adds that capability.
�Oooh, nice, noted.
I'll have to stare at what CommonJS wishes as package markup and think: yes I'velooked, its a bit naive and flimsy for my taste atm (but packaging is a prfessional hazardher, RPM is known to cause insanity, me included).