World: r3wp
[Tech News] Interesting technology
older newer | first last |
BrianH 10-May-2007 [2205x2] | I still prefer the opposite. Did you see the discussions we had on the blog? If you modify my proposal for the additional parse operation in the way Volker suggested, by getting rid of the LOAD keyword, you can unify the block and string parse dialects. That way you can leverage the REBOL loader right in your parse rules but still fall back on string parsing if that doesn't work. |
And by fall back, I mean backtrack in the Icon sense. | |
btiffin 10-May-2007 [2207] | :) It's why I mentioned it... I like that approach...but I'd still like to be able to explain the scripts I write (in front of bosses) without going too techie. Maybe we'll get both :) |
BrianH 10-May-2007 [2208] | Do you have to do a line-by-line explanation, or can you give an overview? |
btiffin 10-May-2007 [2209x3] | Both. Line by line for the simpler, then I'll code a few lines and wait to see if they ask what the sequence is doing. |
It puts them in a very comfortable zone and in a head space where they can think about and request very specific options and outcomes. | |
And I don't have to write UIs that don't attack the problem at hand (their problem at hand, not the one I the coder nerd might be thinking). | |
Anton 11-May-2007 [2212] | Btiffin, from previous discussions, I'm probably with BrianH on this one. But I'd like it if you could come up with some scenarios from real life. Then each of us could try our approach to solving the problems and compare. |
Volker 11-May-2007 [2213] | load/relax can be written based on this: http://www.rebol.net/cookbook/recipes/0042.html ;) |
btiffin 11-May-2007 [2214] | Volker; Not sure. This type of thing happens when bosses type their own data...They don't really really need to type their own data, but it empowers them. 10-Mar-2007 $12,002.34 "Home Hardware" "Tile Saw" 1--Mar-2007 $12002.34 "Home Hardware" "Tile Saw" It's the fact that REBOL "knows" it's a syntax error, that got me to thinking about gibberish! or the invalid? test in the first place. I'd like to be able to show the user where the data failed, call notepad and let them try again. Now I just say try again and call notepad, can't help them much. |
Volker 11-May-2007 [2215x3] | text: { 10-Mar-2007 $12,002.34 "Home Hardware" "Tile Saw" 1--Mar-2007 $12002.34 "Home Hardware" "Tile Saw" } parse text blk-rule: [ some [ str: newline | #";" [thru newline | to end] new: (probe copy/part str new) | [#"[" | #"("] blk-rule | [#"]" | #")"] break | skip ( either attempt [ set [value new] load/next str ] [ probe :value ] [ new: find str " " print ["GIBBERISH" copy/part str new] ] ) :new ] ] |
based on that you can build your own load (add code to collect stuff in blocks) and add "spellchecking" in the gibberish-part. | |
ml-contest, smartest loader? :) | |
btiffin 11-May-2007 [2218] | Cool... |
Gabriele 14-May-2007 [2219x2] | Jaime, (f a b) *must* be quoted or be in a quoted list (maybe using the "funny" way of quoting available for macros ;) for it not being a function call. |
Jaime: you can write a REBOL interpreter in C but you can't compile REBOL to C. You can compile Scheme to REBOL but you can't compile REBOL to Scheme. The conclusion is that there is something in REBOL that Scheme lacks. If you make a language X that has the same features as REBOL, then it becomes easy to compile REBOL to X (X will need to be an interpreter - well, always assuming you don't have a special CPU that can make REBOL compilable). | |
Pekr 14-May-2007 [2221] | Gabriele - isn't it in fact big defficiency of Rebol, that it can't be compiled? That way we are one level slower than others, forever, no? :-) well, I probably oversimplified it few bits :-) I suspect that is the price for the ability to have self modifying code, but if I understand it correctly from what Jaime says, Scheme or Lisp are self-modifying too, yet those can be compiled .... Where is the difference? Any simple clarification for non low-level language person like me? |
Gabriele 14-May-2007 [2222x4] | rebol is not compilable because it can express things that a compilable language cannot express. |
if you are willing to give up the advantage in expressivity, you can just use a compilable dialect and compile to rebcode or even C etc. | |
also keep in mind that 90% (or maybe even 99%) or rebol scripts that people write could be compiled, as they don't take advantage of 100% of rebol | |
(but I guess that 80% of my scripts are not compilable ;) | |
Volker 14-May-2007 [2226x2] | hotspot can compile code which changes later, so i am not conviced :) |
i think self and its "childs" could do it. | |
Anton 14-May-2007 [2228] | Err... most of my code surely cannot compile either :) |
Gregg 14-May-2007 [2229] | Remember, too, that REBOL is not first and foremost a programming language. If that had been the main goal for REBOL, I have no doubt that Carl would have designed it to be compilable, and probably provided a compiler from the beginning. |
BrianH 14-May-2007 [2230] | I still think that most of my code is compilable - you just need to think about the semantics in the right way. |
Volker 14-May-2007 [2231] | Its compilable if some of the info is gathered on runtime IMHO. Maybe with the option to switch back to the intepreted code, to solve gabireles changed 'if. |
BrianH 14-May-2007 [2232x2] | One of the tricks you would need is to realize that there is no "REBOL" language. Each dialect is semantically a seperate language, with a different execution model. You can't treat REBOL data as a particular dialect until you know which one, and you often don't know until runtime. Because of this you would have to compile at runtime, or at least function build time. Any attempt to compile ahead of time would change the semantics, in a similar way to how prebol does. Even at runtime the semantics would be different, but not as different as you think. Few people realize that while the DO dialect looks a lot like a Lisp or Scheme clone, its underlying semantics are quite different - and yet they still are able to program in REBOL just fine. You could change the underlying semantics to a completely different model and keep all but the most guru of programming similar enough that most people won't notice the difference. The only main change would be to make the code blocks of compiled functions unchangeable once the function is built - so no more patching running code. |
Don't expect too much of a speedup though. REBOL is really fast already, and runtime compilation has some overhead itself. | |
Volker 14-May-2007 [2234x3] | Yes, compilation must be done on block-level, and preferably after the block has already been interpret. to find function-boundaries. but self could go half as fast as c, and hotspot even faster. while switching back and forth between compiled and interpreted code. |
and for scripting there would be a slowdown, except if the vm could store the results of the compilation as exe, with the original interpreter-code. kind of quick loadable memory-dump. | |
(dont ask me how that works, i only know some system can do it) | |
btiffin 14-May-2007 [2237] | Volker; Thank you. Your parsing data code made me and REBOL look like heroes today. :) Another happy boss, less afraid of his computer. We all win. Thanks! |
Oldes 14-May-2007 [2238] | I really would like to see some of my functions compilable, using rebcode or something else... Since I'm now working on a new version of my rebol/flash dialect, I found very difficult to bind functions into another (recursive) function's context. At this moment I still have to define these "inside" functions in the recursive function always when I call it, so it must be slower. Maybe it would be enough form me, just to have some more easy and fast way how to get such functions into specified context. But maybe I just have bad approach. |
JaimeVargas 14-May-2007 [2239x6] | (f a b) *must* be quoted or be in a quoted list (maybe using the funny" way of quoting available for macros ;) for it not being a function call." This is simply not true. Not with syntax-case macros. You need to know that Scheme Macro system is different and a lot better than the one used by lisp as pointed by the article. |
See example 6. That introduces a macro for setters and getters, and depending the position of the variable it behaves one way or another. | |
I don't think the compilation of Rebol language has anything to do with CPU features. But CPU are algorithms in silicon, so maybe you could in the future expedite branch searching. | |
And regarding quotation, every block in rebol is quoted in the sense that it is just data. It only acquires meaning when passed thru some form of evaluation. Like DO or a Func eval on a block. Square Bracket become the form (quote arg ...) of Scheme. | |
Regarding the conclusing I find this base less. There is nothing missing in Scheme. The first Rebol interpreter was written in Scheme. I already said this both languages are Turing complete so they can perform the same computations. As I said the topic of compilation vs interpretation is arid regarding PLD. But compilation vs compilation is important for performance considerations and for bootstrapping. | |
Compiling Scheme to Rebol has nothing to do with that argument. imo. | |
Volker 15-May-2007 [2245x2] | There is nothing missing in scheme, but there is something missing in rebol :) Lots of parens for example. To solve such situations, rebol needs runtime-informations. Which function do i have here at this moment, with how many arguments? Without that information the meaning of some code is not clear, and it is only available at runtime. So early macros have no chance here. Then there are dialects. They are data with rebol inside. Which parts of a parse-rule can be compiled to rebol? Could work if 'parse is a macro, up to some point. But then there is vid. A macro would need to write a lot [ make face[] ]. Such things grow big. And even then, look at [text a b] . At runtime this is easy, [a: 60x24 b: "Hello Scheme"], no problem. At macro-time no chance IMHO. Scheme can be compiled to rebol, because a scheme-programmer has to give enough informations at compile-time. Rebol can not be compiled to scheme because rebol lacks that information. Making the life for the programmer easier, because more can be implicit. Scheme could interpet dialects too, but then its no longer compiled. ANd it can not as good, because rebol-data can reference locals. Symbols with context. And scheme can not AFAIK, symbols are only unique strings. (i still hope i miss something, maybe a schemer would use little closures?) |
(MY first counter: making to much implicit actually makes life for programmers harder, when he reads it. But that holds for large programms, and rebol is optimized for small. | |
Gabriele 15-May-2007 [2247x2] | the first rebol interpreter was written in C (not Scheme) by a Schemer... and indeed it was *not* rebol and Carl had to rewrite it from scratch. :) |
so, if there's nothing missing in scheme, i challenge you to write a translator from rebol to scheme. i will do a translator from scheme to rebol if you want me to. this has nothing to do with being turing complete. brainfuck is turing complete, but don't tell me it's the same as scheme. | |
Henrik 15-May-2007 [2249] | i will do a translator from scheme to rebol if you want me to. <--- don't you have R3 stuff to do? :-) |
Gabriele 15-May-2007 [2250x2] | do you expect me to do that overnight? ;) also, i think it's very easy to do. (a translator does not mean that all the function are then available, just that you translate code, and as long as you define the functions in rebol, then you can evaluate it) |
and anyway, i don't think jaime will ever be able to do a rebol>scheme so there's no problem ;) | |
Maxim 15-May-2007 [2252x3] | although I'm not an expert on languages (even if I have been fiddling with antidote a bit) the binding of code in REBOL seems to be the compilation killer. the fact that any data only gets meaning when a particular part of code is reached and depending on the current state of the whole heap, means its impossible to compile by default. |
btw, trying to bring the discussion to a less tech level ;-) some people are way lost here ;-) I know I am just at the edge of understanding! | |
but wouldn't the bind command and any internal rebol binding, be in fact where the JIT calls are made? aren't these explicit points in time where a JIT could be applied? | |
older newer | first last |