Feature requests

Started by Jeff, January 26, 2009, 09:36:11 AM

Previous topic - Next topic

Jeff

Lutz,



I have a few feature requests.



Trees and setf



When using trees, setf fails when the symbol has not yet been defined:


(setf (Foo "bar") 123)

I know that this is because their is no symbol to reference, but in this case, shouldn't the symbol be implicitly created?  The intention is obvious to my mind.



Cilk interface



I would like to be able to sync individual processes by symbol. As it stands at the moment, I cannot distinguish between two sets of processes spawned in the same parent process. This is not as rare a situation as you might imagine. For example, a socket server might fork to respond to clients, but also have another process that is forked every so often to perform a background task without tying up the listener.



I imagine it would be hard to implement, but it is a change that I think really ought to be made.



Semaphores



Could you add a timeout parameter to semaphores when decrementing, so that I can specify in milliseconds how long I am willing to wait for a semaphore?
Jeff

=====

Old programmers don\'t die. They just parse on...



http://artfulcode.net\">Artful code

Lutz

#1
* new keys in hashes



Why not use the normal:


(MyHash key value)

which always works, instead of:


(setf (MyHash key) value)

which only works on existing keys, but if you must use 'setf', you could do:


(setf (MyHash key true) value)

which will work even if key is not defined yet, but will also be slower, because it really sets the key twice.



* Cilk interface



Cilk on newLISP will evolve slowly and stay close to the official spec. The nice thing about the current minimal implementation is, that it does not need semaphores at all.



* semaphore timeout



You could inquire the semaphore status and put a wait loop around it (not on Win32):


(dotimes (i 10 (> (semaphore sid) 0)) (sleep 100))

would wait for one second and you could process other stuff in the same loop and observe several semaphores at the same time. You could build a function based on this or similar.



The loop will finish early when the semaphore value rises above 0.

Jeff

#2
Lutz,



Regarding hashes - I like setf, and it is more expressive and explicit about what it is doing than (Foo "bar" 7).  While it is understandable why it works the way it does, it is an inconsistent behavior and becomes a "gotcha" that programmers have to remember to work around in a language.



Cilk - you are correct. I thought that the spec allowed for synchronization of individual variables.



Semaphores - I do use something like that when I need a timeout, but it is hard to balance speed and overhead on that. I don't know the semctl interface, but I had hoped that it had some functionality that could have been exposed. I think the better way would be to start with a shorter interval and after so many polls, increase it.
Jeff

=====

Old programmers don\'t die. They just parse on...



http://artfulcode.net\">Artful code