World: r3wp
[!REBOL3-OLD1]
older newer | first last |
BrianH 14-Jun-2009 [15572x2] | OK, I just looked at bug#924 and now get what you want to do. It's not a bug, it's by design. The code block of a module is bound before the block starts executing. You can't define new words in the module's context unless those new words are defined in imported modules or in the code itself at the top level, or anywhere in the code if the module is isolated. |
Sorry, bug#928, not 924. | |
Maxim 14-Jun-2009 [15574] | why is that? this means we can't create new words in a module at run-time? |
BrianH 14-Jun-2009 [15575] | Right. Even if you did you wouldn't be able to use them because the code would already have been bound. |
Maxim 14-Jun-2009 [15576x2] | aren't module contexts auto-expanding? |
but in the script (previously global) context... every word is bound to the script context when loaded, why not providing the same for modules. if it hasn't been set when its encountered then you raise the proper unset error. | |
BrianH 14-Jun-2009 [15578] | Not really. They are (using a hack), but the binding of the code block is done after the imports are processed and before the code block starts executing. Once the code block starts executing the module context has already been defined. REBOL's evaluation and binding rules preclude any automatic rebinding. |
Maxim 14-Jun-2009 [15579x2] | but the word exists in the module before the script is done.... its just not set yet... so it should be bound in the module and the script sets the value, since its running in the context of the module. |
what you are saying is that for modules, we need to start declaring words? not very rebolish. I have to do so in slim to keep words local to the calling context, but I would have tought that modules would do so automatically since they replace the global context. any new word in the root of the spec block of the module should be added to the module's context and set to unset! just like R2's global context does. | |
BrianH 14-Jun-2009 [15581x3] | Um, no, a DOne script is running in its own context if it is a module, or the current context if not. The current context is not the context of the calling code - it exists independently. |
Modules have their own context, but they don';t replace the "global" context. | |
Any set-word in the top-level of the module's code block is added to the module's context before the module code runs, just like an object. If you isolate the module, every word in the module's code block and all nested blocks, parens and paths are added to the module's context. The only words you need to "declare" are the exported words. | |
Maxim 14-Jun-2009 [15584] | ok that makes sense now. |
BrianH 14-Jun-2009 [15585] | The bug#928 should be dismissed, marked as "not a bug", and left there for future reference. Thanks for helping document R3 :) |
Maxim 14-Jun-2009 [15586x4] | but its revealing something deeper... DO is now totally useless. |
cause it can't interact with the context its being called from. | |
well, in the module's perspective anyways. | |
(totally is a strong word... hehe) | |
BrianH 14-Jun-2009 [15590] | Not totally. It is useful in non-module scripts, and useful for scripts done for effect rather than for loading functions. |
Maxim 14-Jun-2009 [15591] | ok let me do a single little test... |
BrianH 14-Jun-2009 [15592] | Also, the IMPORT function is basically a fancy DO. |
Maxim 14-Jun-2009 [15593x3] | oops noticed that I mismatched the bug number in the code examples of bug#928... I'll edit them. |
just like slim's LOAD is a fancy DO ;-) | |
that would be slim's 'OPEN... starting to be late... hehe | |
BrianH 14-Jun-2009 [15596x2] | Of the module bugs you have posted, the one that is still pretty nasty is bug#923. Needs tracing :( |
Good night, be back tomorrow if I can. | |
Maxim 14-Jun-2009 [15598x3] | ok... here is a twist on bug 928... :-) if I add myfunc: none at the top of the module in the supplied example I get this error instead: Evaluating: /D/dev/project/liquid-r3/debug/mymodule-bug924.r ** Script error: print word is not bound to a context ** Where: catch if either either do begin do ** Near: catch/quit code >> |
this one I can't see how it can be proper, even if you can explain it. | |
note... 'PRINT is not bound to any context !!! wtf? | |
BrianH 14-Jun-2009 [15601] | In which of the 3 files do you put the myfunc: none ? |
Maxim 14-Jun-2009 [15602x2] | rebol [ type: 'module name: 'mymodule-bug928 ] print "TADAM ... mymodule-bug928" myfunc: none do %myscript.r myfunc 928 |
print is global it should accessible from any DO. | |
BrianH 14-Jun-2009 [15604] | Again, I'll be back tomorrow if I can. |
Maxim 14-Jun-2009 [15605x3] | sure... better build a convicing argument cause the above is not acceptible ;-) |
heheh good night. | |
I'm going back to comfortable R2 development now... | |
BrianH 14-Jun-2009 [15608] | It's a different bug than the one reported in bug#928. Good night. |
Maxim 14-Jun-2009 [15609] | ciao |
Janko 15-Jun-2009 [15610x2] | Apples idea how to do real concurrency (on multicore) .. http://images.apple.com/macosx/technology/docs/GrandCentral_TB_brief_20090608.pdf -- it seems to be based on something like closures (or blocks from smalltalk) -- it seems simple and clean idea |
I posted it here as a food for thought on one of REBOL3 next developments.. making it concurrent | |
Ladislav 15-Jun-2009 [15612x2] | Janko: did you post it to the R3 chat too? - may be better for Carl than this place |
(I reposted it) | |
Janko 15-Jun-2009 [15614] | thanks .. I am not on R3 chat. I don't use R3 and R2 has enough secrets to discover for me still |
Pekr 15-Jun-2009 [15615] | So called Erlang style concurrency - brief info - http://ulf.wiger.net/weblog/2008/02/06/what-is-erlang-style-concurrency/ |
TomBon 15-Jun-2009 [15616] | as said before, rebol with erlang like concurrency is a dooropener for many professional projects. btw mnesia, the distributed hybrid database is very nice too. |
Will 15-Jun-2009 [15617] | Here is a great example code using GrandCentral: "DispatchWebServer" from the description: "A web server that uses one queue per HTTP connection. Supports HTTP pipelining and on-the-fly compression. Also shows use of dispatch-style signal and vnode event handling." https://developer.apple.com/snowleopard/library/samplecode/DispatchWebServer/index.html (ADC account needed) Whoever is doing R3 on OS X, should have a look 8-) |
Sunanda 15-Jun-2009 [15618] | Any good reason why true? is defined, but not false? |
BrianH 15-Jun-2009 [15619] | Because we already had that function: NOT. It is left to the user to declare false?: :not if they wish. That was the rationale at least. |
Pekr 15-Jun-2009 [15620] | why such an ommision? if we have true?, then we surely have to have false? ... it almost feels like a design bug to not have one .. |
BrianH 15-Jun-2009 [15621] | It might be added later, like empty?: :tail?, but so far we have been focusing on missing functionality. Things like that will likely be added later on when we are finishing up. |
older newer | first last |