(define a
(lambda (n) (* n n)))
(define a
(lambda (f x) (f x x)))
(a + 4)
run it and you will see there's no error when you try to replace the definition of the function a
Name:
Anonymous2007-08-06 8:00 ID:c7V00J+8
I'm talking about changing things in some external way... like if I want to patch my server with a fixed function without starting it. And I don't really want to have to build stuff into the application.
Name:
Anonymous2007-08-06 8:05 ID:nXB9qMQ9
like if I want to patch my server with a fixed function without starting it. And I don't really want to have to build stuff into the application.
What? Just leave a REPL open and patch to your heart's content. You can do this with any halfway decent language.
while true
doSomething
sleep 1
Dir.glob('foo/*.rb' ) do |f|
if lded.include?(f) == false or lded[f] < File.mtime(f)
lded[f] = File.mtime(f)
instance_eval(IO.read(f))
end
end
end
Then just drop replacements in "foo/". For example this: def doSomething
print 'bar', "\n"
end
I’M GUIDO
SON OF A BITCH RUBY
RUBY IS PIG
DO YOU WANT REFLECTION?
DO YOU WANT GARBAGE COLLECTION?
RUBY IS PIG DISGUSTING
MATSUMOTO IS A MURDERER
FUCKING RUBY
I’M MATZ
SON OF A BITCH PYTHON
PYTHON IS PIG
DO YOU WANT FUNCTIONAL PROGRAMMING?
DO YOU WANT INDENTATION?
PYTHON IS PIG DISGUSTING
GUIDO IS A MURDERER
FUCKING PYTHON
Name:
Anonymous2007-08-06 18:28 ID:I0mfdSLP
>>1
Take a look at the kernel functions in windows, or pretty much anything from MS (incl. DX), they all have a prologue which looks like:
mov edi, edi
which is basically a 5-byte NOP. The reason? So they can place an unconditional jmp instructions (which is 5 bytes) to fixed functions, effectively producing hot-fixes, without having to reload the module. Pretty neat if you ask me.
>>33
mov reg32, reg32
is only 2 clock cycles, according to the Intel Opcodes and Mnemonics manual.
I imagine the CPU can do some specially trickery during the prefetch stage to skip actually reading the instruction. Can any CPU gurus confirm?
Name:
Anonymous2007-08-06 23:24 ID:WZ+avijf
Any fucking language with any fucking sort of `eval` statement (or even without it — you will just have to work on some mechanism to dynamically load functions and update call tables etc). Thread over.