[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: sph.io libraries
Re: sph.io libraries
Tue, 22 Jul 2014 13:12:28 +0200
Neat. Just to double-check - the environment variables of my current
preserved or /tmp/mybin would run with environment consisting only of
the new process receives only the specified environment variables. but
it should be no problem to pass it a
modified environment from the current process using guiles "environ"
I've explicitly put into execute-with-environment?
(cons "XX2=LOL" (environ))
guile -c '(import (sph process)) (execute-with-environment (cons
"XX2=LOL" (environ)) "env")'
actually in guile the direct interface to execve is called execle
the only interface to execve for guile
the "process" version does two more things:
- it adds the program name as the first argument, the usual calling
convention. would have to be taken care of manually otherwise
- it may search $PATH
- it moves the "env" argument to the front to preserve the order of
filename and rest-arguments
Could you illustrate that with some code too? I do not plan to have
that many records
so I'm not concerned with the speed that much :)
the getter/setter definitions where included in the last example.
setting fields by symbolic name would look like this:
(define triad (make-record-layout (quote (pid env num))))
(define t (record triad pid "LOL" 5))
(record-set! t triad (quote pid) 5011)
the getter/setter definitions could be shortened with a new single
"define-" form which generates the bindings. i might add that and the
current library makes this quite easy.
for reference, other record implementations already do this, but these
implementations regard records as something more complicated.
if you do not want to deal with record-layouts, getters and setters,
you could use vectors which are like arrays in other languages (which
could be records at the same time)
(define a (vector 3 4 5))
(vector-ref a 0)
or hashtables, which are like associative arrays or objects in other
(import (sph hashtable))
(define a (hashtable "a" 1 "b" 2))
(hashtable-ref a "a")
or association lists, alists, which are lists and similar to
(import (sph alist))
(define a (alist "a" 1 "b" 2))
(alist-ref a "a")
I can also have arbitrary number of fields in the record?
your libraries to be packaged and readily available in my distro
what is your distro?
there is a package for arch linux at least
and there is "guix", which seems to become the package manager for the
gnu system, and might be interesting cross-distro. though as of yet i
have not figured out how to make a package for it.
Re: sph.io libraries,