AltME groups: search
Help · search scripts · search articles · search mailing listresults summary
world | hits |
r4wp | 64 |
r3wp | 928 |
total: | 992 |
results window for this page: [start: 65 end: 164]
world-name: r3wp
Group: !AltME ... Discussion about AltME [web-public] | ||
Graham: 6-Jul-2006 | Wonderful *** AltME ERROR *** Sorry, AltME found an error while it was starting up. This should never happen, but it looks like it just did. Go to http://www.altme.com/feedback.htmland cut/paste the text below. We'll fix the problem right away! Thanks. ERROR: Error starting module: a00 [ code: 303 type: 'script id: 'expect-arg arg1: 'bind arg2: 'known-word arg3: [word!] near: [ctx-text: context bind ctx-text system/view] where: 'do-module ] Press enter key | |
Volker: 6-Jul-2006 | looks like they somehow mixed versions. "ctx-text: context bind ctx-text system/view" that feature is somewhat new. does it try to load new source with the old exe? | |
Group: RAMBO ... The REBOL bug and enhancement database [web-public] | ||
Ladislav: 1-Jul-2005 | this looks strange: >> o: make object! [test-word: none] >> do bind probe reduce [to set-path! 'test-word to lit-word! 'test-contents] in o 'self [test-word: 'test-contents] == test-contents >> probe o make object! [ test-word: none ] | |
Ladislav: 2-Sep-2005 | to the VALUE? crash: the following code crashes too: x: bind make block! {error? try [any-type? get/any 'variable]} 'system do x | |
BrianH: 27-Oct-2005 | Integer operations: - conversions between integers and binary and back - bswap opcode for endian conversion - picki and pokei, like pick and poke but for bytewise access to integers - perhaps allow tuples to be treated like integers for opcode purposes, or to-tup/to-int for conversions between them Word operations: - set indirect for things like forall, 'a parameters, other uses - for objects/contexts: bind ["Bind a variable to a context" word! word!] Struct operations: - sets ["Set a field value of a struct" word! word! word!] - gets ["Get a field value of a struct" word! word! word!] - copys/changes or picks/pokes (see other group for details) | |
Volker: 7-Dec-2005 | But yes, the words have to exist in case something in a block wants to bind to it. Or it gets complicated. | |
[unknown: 5]: 24-Dec-2005 | I'm not saying that it doesn't bind a word to system/words - its just my opinion that it shouldn't do so until it correctly ensuring the syntax is correct of the alias function | |
Group: Core ... Discuss core issues [web-public] | ||
Brett: 2-Mar-2005 | ; Jaime try comparing your example with this: o: context [a: 0 b: o1: none] o/o1: context bind [a: 1 c: 3 set 'b 2 o2: none] in o 'a o/o1/o2: context bind (bind [set 'b 4 set 'c 5 set 'd 6] in o 'a) in o/o1 'a ; I think you'll find they are equivalent. | |
Brett: 2-Mar-2005 | I don't think there is a hierarchy of contexts. In Jaime's example there is a hierarchy of blocks (nested). As evaluation proceeds, the words in those blocks get "painted" different colours. That's why my code using bind ends up with the same binding of words even though I didn't have the same hierarchy of blocks - I simulated the same order of binding. | |
Volker: 2-Mar-2005 | 'a is first bound to 'global, then to 'red, then to 'blue (going from outer to inner block). then it stays blue until you bind it again. | |
Brett: 2-Mar-2005 | I guess what I'm saying is that the idea of a lookup chain is not needed to understand rebol. We only need to know that a rebol word is a member of some context and that association between a word and its context can be changed by functions like Context, Bind, Func and Use when they are evaluated. | |
ChristianE: 29-May-2005 | func: func [ "Defines a user function with given spec and body." [catch] spec [block!] {Help string (opt) followed by arg words (and opt type and string)} body [block!] "The body block of the function" /name word [word!] ][ either name [ use [self] [ self: word throw-on-error [make function! spec bind body 'self] ] ][ throw-on-error [make function! spec body] ] ] | |
Ladislav: 23-Jun-2005 | bind to-word "no-b" 'no-a | |
Piotr: 23-Jun-2005 | so, fifth line (of example above) looks like: foreach x [a b c] [ d: to-word join "no-" x bind d 'no-a set d "test-2" ] but his still does not work (for me) | |
Ladislav: 23-Jun-2005 | ctx: context [ no-a: no-b: no-c: none set 'test does [ foreach x [no-a no-b no-c] [set x "test-1"] foreach x [a b c] [ d: bind to-word join "no-" x 'no-a set d "test-2" ] foreach x [a b c] [print [join "no-" x get (to-word join "no-" x)]] foreach x [no-a no-b no-c] [print [x get x]] ] ] test probe no-a probe ctx/no-a | |
Volker: 23-Jun-2005 | i guess bind returns a new word here, but does not change the old? so it must be d: bind d 'no-a | |
Volker: 23-Jun-2005 | >> c: context[a: 123] >> a: 234 == 234 >> b: 'a == a >> get b == 234 >> bind b c == a >> get b == 234 >> b: bind b c == a >> get b == 123 | |
Volker: 23-Jun-2005 | thats to-word and 'bind. your problem was that bind does not change its argument, but returns a new different bound word. which may confuse because with a block, it changes that block. | |
Piotr: 23-Jun-2005 | i think that bind and varialbles "bounded to local or global context" are black magick for new rebolers; hard to understand and even harder to explain... | |
Pekr: 25-Jun-2005 | Is it possible to get b/1 evaluated? I am not sure it is because of non-aggresive word evaluation, but maybe question for you 'bind gurus? :-) | |
Pekr: 25-Jun-2005 | foreach :b a [print bind b 'x] ? | |
Pekr: 25-Jun-2005 | and for gurus - what happens here? :-) foreach :b a [print bind b first :b] 3 3 3 3 3 3 | |
Volker: 25-Jun-2005 | >> b: [x y] == [x y] >> foreach :b [1 2 3 4 5 6][bind b 'x print get b/1] | |
Pekr: 25-Jun-2005 | yes, I know, but you used 'x ... that is the tricky question - we wanted to create it dynamically, so we wanted to use bind b b/1 (we thought that instead of b/1 interpreter somehow will understand cleverly, that we mean x in context of foreach function :-) | |
Brett: 26-Jul-2005 | ; Q1 Or if you know you can reduce it you could do something obtuse like: block: ["a" none "b" none none] use [none][none: does [copy {}] bind block 'none] reduce block | |
Rebolek: 8-Aug-2005 | I'm tring to expand functions, but unfortunatly I'm not good in bind-magic so I've no success. I've got following code: | |
Rebolek: 8-Aug-2005 | I've tried to bind it to 'a or 'value but without success. Can somebody help me? | |
Chris: 9-Aug-2005 | ; Similar, but you can ensure the position of a word to bind to -- b: func [value][print ["value:" value]] a: func [value][[value] probe value] append second :a bind [b value] first first second :a | |
Ladislav: 9-Aug-2005 | ...you just need one properly bound variable and you can bind all other code using | |
Chris: 9-Aug-2005 | That makes it difficult -- to bind one context to another, you need that word from the target context. And functions don't have a 'self value like objects. Nor are 'first and 'third values bound to the 'second. | |
Chris: 9-Aug-2005 | eg. I don't think it'd be possible to bind any block to -- a: func [x y][] | |
Geomol: 5-Sep-2005 | context question: If I inside a context block (an object) in one program write: do %some-program.r then I can't reach words and functions in the first program from the second. I've also tried to bind words to the first context, but without luck. Any ideas? Maybe I should put 2 small test-scripts here: | |
Gabriele: 5-Sep-2005 | do bind load %prg2.r self | |
Geomol: 6-Sep-2005 | Gabriele, thanks! That "do bind load <something> self" is, what I'm after. :-) | |
Group: I'm new ... Ask any question, and a helpful person will try to answer. [web-public] | ||
DideC: 10-Mar-2005 | ctx: context bind [ chars: charset [ #"A" - #"Z" #"a" - #"z" #"0" - #"9" #"-" #"_"] non-chars: complement chars set 'copy-word has [start end end-rule car-pos] [ if any [not focal-face not caret] [exit] car-pos: index? caret end-rule: copy [] parse/all head caret [ any [ start: some chars end: ( if all [car-pos >= index? start car-pos <= index? end] [end-rule: 'break] ) end-rule | some non-chars (start: end: none) ] ] if all [start end] [write clipboard:// probe copy/part start end] ] ] in system/view 'focal-face view layout [ area "This is some text to test" text "To copy the word under the cursor : hit CTRL+K or press the button bellow" button "Copy word" #"^K" [copy-word] ] | |
Anton: 10-Mar-2005 | There's a nice example of BIND. The whole block of words is first BINDed to the system/view object. Only the words that already exist in system/view (like 'copy-word) will be rebinded, (because objects cannot be extended with new words). | |
Anton: 10-Mar-2005 | So it's a double-bind :-) | |
Luisc: 10-Mar-2005 | I have been looking at scripts Anton on Bind ( found over 40 at rebol) . This is great !!! 8D | |
Luisc: 10-Mar-2005 | donno but it does what i need =) and it looks "easy" hmmm I can see why someone can get addicted to rebol. I need to study more about bind and parse. | |
Normand: 12-Apr-2005 | Speaking of double bind, I have no clue of the how-to to this clue. In Ocaml we can make co-recursive definitions, also with negation. But when I try this on Rebol, it claims the value before I have the time to define it: a: not b and b: not a. Interp: ** script error, b has no value. What is the method ? Or are we out of paradise? I could use that as a form of loop, or a form of lexical closure to model some linguistic phenomenas. But how? We know the problems of complement of complement, but as a function value it should be feasible. | |
RobertS: 5-Aug-2007 | re: comments in 'core' on the plague of MI ... multiple inheritance works rather nicely in Curl since you are required to provide 'secondary' constructors - I prefer prototype-based with an option for class hierarchies, personally ( try experimenting with Logtalk if you can find time ). I am watching Io, the language, evolve as Rebol3 emerges: what is interesting to me is that I ask 'But is that Oz ?' in Oz. ( which is multi-paradigm ) I used to hear a lot of 'getting it' about Prolog and Smalltalk. After almost 2 decades in both, I think many of them "didn't get it" ( class hierarchy obsessed, as ST purists are/were ). Ruby is so much like Smalltalk that I am quite enjoying watching Groovy play catch-up with Ruby Most issues in Rebol have a parallel in Javascript; where ( for the neophyte) experiments with typeof in a console is about the only way for the average developer to 'get it' given d1 = Date // now you use d1 as a function d1() d2 = Date() // d2 is a string that looks like a number d3 = new Date() // d3 is an object but it is UTC but it is presented local time but it is compared UTC .... or s1 = "string" s2 = String("string") s3 = new String('string') s3[1] = 6 // s3 is an object, as typeof of reveals; String 'equality' in JavaScript even with === is no end of grief and for what convenience ? s3["size"] = 6 or a1 = Array(42) a2 = new Array(42) I think the latter 2 show just how rushed LiveScript was pushed/forced out to market as "LavaScript" before the Sun "StrongTalk" folks had much influence on the Netscape folks .... Rebol3 is in better hands than 'ActionScrtpt' as it drifts into classes - because it is being kept 'in hand'' The changes in Groovy as it complied with the JSR for Java scripting are interesting ( Groovy is almost neat as Rebol would be if it were confined to, say, living on top of VisualBasic ;-) Now to avoid 'Rebol on Rails' ... I think some people who adopted Spring to cope with Java would appreciate Rebol ( there, too, you have to 'get it ' ) MySubClassObject.prototype = new MyParentClassObject() // now go mess with THAT object before it is useful ... // ... MySubClassObject.prototype.superclass = MyParentClass // to fake having a superclass other than Object cannot be much easier to "get" than anything about Rebol use ; now mostly use /local and bind ; modifies the block it is passed; use COPY refinement to preclude this side-effect Smalltalk80 was like "Rebol4" as compared to the first passes at an O-O language ... someone who actually understands Smalltalk contexts/blocks and JavaScript should 'get it' with Rebol ( some of those people are using Seaside with Squeak, Dolphin and/or VisualWorks ST ) my 2 cents: a1 should have been an array of fixed size and only a2 should be a Vector object | |
RobertS: 30-Aug-2007 | ; Just FYI ... Ladislav Mecir has an excellent page on bind at http://www.fm.tul.cz/~ladislav/rebol/contexts.html But it does not warn you not to try >> someWord: make word! ":test:" >> print bind? 'someWord ; BAD IDEA I am fine with >> none? bind? 'someWord or >> equal? bind? 'someWord bind? 'someContext Printing the global context seems like a bad idea, at least when my PC is carrying a heavy load ;-) | |
Group: Parse ... Discussion of PARSE dialect [web-public] | ||
BrianH: 26-May-2007 | Aside from the one-time bind, repeat may be faster than loop with a self-incremented index. | |
BrianH: 26-May-2007 | It looks like repeat doesn't bind its argument, so it is definitely faster in this case. | |
Anton: 27-May-2007 | BrianH, what ? Repeat does bind its argument, doesn't it ? >> repeat n 4 [] >> n ** Script Error: n has no value ** Near: n | |
Rebolek: 7-Jun-2007 | just a quick idea: FORALL is implemented as mezzanine function. It calls FORSKIP which is mezzanine also. As you can see, it's probably not the fastest method. So here's the idea. Cannnot be FORALL rewritten to make it faster and is it possible to use PARSE to do this? So I tried and came up with this simple function: parall: func [ 'word body /local data ][ data: get :word parse data compose/deep [ some [(to set-word! word) any-type! (to paren! [do bind body :word])] ] ] (parall is just a shortcut for parse version of forall). this is very simple function written in five minutes and not very well checked, it needs some additional work (eg. it does not return same value as 'forall etc). So let's do some test (using Ladislav's %timblk.r): >> n: copy [] repeat i 100 [append n i] == [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 4... >> time-block [forall n [b: n/1 + 1]] 0.05 == 3.623046875E-4 >> time-block [parall n [b: n/1 + 1]] 0.05 == 3.814697265625E-6 >> 3.62e-4 / 3.81e-6 == 95.0131233595801 95x faster? whooo.... and what about bigger block? >> n: copy [] repeat i 10000 [append n i] == [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 4... >> time-block [forall n [b: n/1 + 1]] 0.05 == 3.540625E-2 >> time-block [parall n [b: n/1 + 1]] 0.05 == 3.7994384765625E-6 >> 3.54e-2 / 3.8e-6 == 9315.78947368421 9000x ? omg... comments? | |
BrianH: 7-Jun-2007 | First tip: You don't have to bind the body - it just uses the existing binding of the word. | |
Group: Linux ... [web-public] group for linux REBOL users | ||
Anton: 18-Dec-2006 | Playing with View 1.2.1 REQUEST-FILE You can bind the patched REQUEST-FILE body to the REQ-FILE context, and that makes it work. | |
Group: Dialects ... Questions about how to create dialects [web-public] | ||
Volker: 16-Sep-2006 | rebol [ Title: "Immersive" Usage: { >> fed fed> p 3 This is a demo line, its not loadable :) p with 3 " This is a demo line, its not loadable :)" fed> print "This is pure rebol" This is pure rebol fed> "this too" == "this too" fed> } ] ctx-fed: context [ arg-lens: [p 2] line: cmd: none last-err: none p: func [lineno line] [print ["p with" lineno mold line] exit] t: func [lineno] [print ["t with" lineno] exit] e: func ["format err"] [throw last-err] do-line: func [line /local arg-len-pos res] [ set [val rest] load/next line either arg-len-pos: find/skip arg-lens val 2 [ cmd: reduce [val] loop arg-len-pos/2 - 1 [ set [val rest] load/next rest append cmd val ] append cmd rest ] [ cmd: load/all line ] bind cmd self case [ error? set/any 'res try [do cmd] [ probe disarm last-err: res ] value? 'res [print ["==" mold :res]] ] ] rebol/words/fed: func [] [ forever [ do-line ask "fed> " ] ] ] fed | |
Group: SDK ... [web-public] | ||
Louis: 28-Mar-2006 | The main problem I have with the SDK is that it makes it harder to find bugs. Does anyone have any idea what is causing this error message: ** Script Error: bind expected known-word argument of type: word ** Near: ctx-text: context bind ctx-text system/view ** Press enter to quit... | |
Gabriele: 29-Mar-2006 | louis, my guess is that the encap version you are running is older than the version that code is expecting. (bind allowing objects is a rather new thing) | |
Group: !RebGUI ... A lightweight alternative to VID [web-public] | ||
Brock: 30-Apr-2005 | I like it so far - haven't looked at the code or how you bind the data. | |
Ashley: 4-Jun-2005 | Question for the bind experts out there. Given two files (named %include.r and %test.r respectively): REBOL [] context [ a: "A" b: does [print reform ["Value:" a]] c: does [print reform ["Value:" d]] ] REBOL [] RebGUI: context [ d: "D" ctx: #include %include.r if issue? ctx [ctx: do %include.r] ] RebGUI/ctx/b RebGUI/ctx/c How do I bind %include.r to the RebGUI context such that it can see 'd (as the #include successfully allows). | |
Volker: 4-Jun-2005 | ctx: do bind load %include.r 'self | |
Chris: 5-Jun-2005 | REBOL [] load-include: func [include [any-block!]][ either parse inlcude reduce [to-issue 'include file!][load include/2][include] ] RebGUI: context [ d: "D" ctx: do bind load-include [#include %include.r] 'self ] RebGUI/ctx/b RebGUI/ctx/c | |
Anton: 6-Jun-2005 | (*possible* way, I should say. I haven't tested that, and it needs bind in ctx-rebgui 'self.) | |
Ashley: 6-Jun-2005 | I eventually solved it with: ctx-rebgui: context [ ... edit: #include %rebgui-edit.r if issue? edit [edit: do bind load %rebgui-edit.r 'self] ... ] it's two lines as opposed to one, but *much* clearer! ;) | |
OneTom: 22-Oct-2005 | how can i bind actions to key combinations globally? | |
Group: !Uniserve ... Creating Uniserve processes [web-public] | ||
Terry: 4-Feb-2006 | And if I LOAD the external file, you would think it would bind it all globally, but it doesn't? | |
Terry: 4-Feb-2006 | Seems it relates to this part (from the docs) Put all the service related code in the service definition. You can include external libraries of code if needed. Everything that's not inside the service definition block will be globally BIND-ed. | |
Group: Rebol School ... Rebol School [web-public] | ||
JaimeVargas: 4-Apr-2006 | MY-WORD: (notice the colon) is the what is used to bind a word (kind of a C assignment) | |
BrianH: 5-Apr-2006 | The other main thing that will likely trip you up is understanding how words, contexts and bind, together serve the role that variables or symbols serve in other languages. I could go on about that, but you would be better served by reading the extensive articles that Ladislav, Gabriele and I have already written on the subject. | |
denismx: 8-Apr-2006 | Words, contexts and bind... : Ladislav, Gabriele and BrianH articles. I suppose I will find those articles on rebol.org? I will look them up and read them. And the presentations on Dialects... although what I understood about that was that one could make up dialects for a particular use. If so, not sure it would help in the ingeneering of a "better" teaching/learning approach for the language. | |
JaimeVargas: 9-Apr-2006 | Symbols can only bind to values. The pointer metaphor is just easy way to expaning things but it is not correct. | |
BrianH: 10-Apr-2006 | And when you bind a, you make it point to another context with another slot in it. | |
BrianH: 11-Apr-2006 | A word is basically a value that can be put in a value slot. This value includes a pointer to a symbol and a pointer to a context. A symbol is like a string that is only stored once. The symbol that is pointed to by a word is the same symbol (same chunk of data) as that pointed to every other word that is made up of the same characters as the word (case-insensitively). A context is like a map from symbols to value slots. When you create a context it has the specified set of symbols associated with it and each one of these symbols has an associated value slot. When you bind a word to a context, you change the context pointer of a word to point to the context. If you try to bind a word to a context that doesn't include the word's symbol, the bind fails silently and the word is unchanged. With the exception of system/words, all contexts are of fixed length once they are created (for now). If the word's context pointer is not set, the word is considered unbound. If the corresponding value slot in the context the word is bound to is supposedly empty, the value slot really contains the unset! value, and the word is considered unset. (Current implementation) Every word you create is added to the system/words context, which expands to include it if it isn't already there. Currently, system/words has an upper limit of 8000 words. This effectively means that the words your script uses must not exceed 8000 unique symbols, including those used by the runtime. | |
Anton: 22-Apr-2006 | Ok, so here's my frequency table: 6 compose 5 as-pair 5 func 4 do 3 show 2 all 2 copy 2 find 2 form 2 get 2 in 2 pick 2 print 2 to-image 2 use 1 * 1 + 1 - 1 <> 1 = 1 append 1 bind 1 center-face 1 change 1 clear 1 context 1 do-events 1 either 1 first 1 foreach 1 if 1 join 1 layout 1 load-thru 1 make 1 mold 1 object? 1 reduce 1 remold 1 remove-each 1 repeat 1 second 1 select 1 to-pair 1 to-path 1 view | |
Group: rebcode ... Rebcode discussion [web-public] | ||
BrianH: 12-Oct-2005 | I've been thinking about temporary variables generated by rewrite rules. I have a way to generate extremely unlikely variable names, but no way to bind them in the rebcode function after they've been added. Any ideas? | |
BrianH: 14-Oct-2005 | (Thinking out loud) It occurs to me that computed branches would be a lot easier if you could reference the target values in your code, so that you have something to compute with. If the offsets were absolute you could just assign them to the label words (something that could be done in the first pass of the assembler rewrite of the branch statements). Relative offsets could be calculated pretty easily if you had something like a HERE opcode that would assign the current position to a variable that could be used soon afterwards to calculate the relative offset. For that matter, the HERE opcode could perform the assignment of the original label as well, and even be accomplished by a rewrite rule in the branch fixup pass of the assembler. Here's my proposal for a HERE assembler directive. No native opcodes would need to be added - this would be another directive like label. This directive could be used to set the target values to words for later computation. Assuming BRAW stays relative and no absolute computed branch is added, it could also be used in computations to convert from absolute to relative offsets. This would be sufficient to make computed branches practical. - A new directive HERE, taking two arguments, a word and a literal integer. It would set the word to the position of the HERE directive, plus an offset specified in the second parameter. The offset would need to be a literal because the calculation would be performed ahead of time by the assembler - 0 would mean no offset. If you don't want to reset the position every time you branch to the word use an offset of 3. Resetting the word after every branch would allow its use as a temporary in absolute-to-relative calculations, but that would only be an advantage until the JIT or optimizer is implemented - the choice would be up to the developer. Having a mandatory second argument is necessary for reasons that will become clear later. - The HERE directive would be rewritten away in the fix-bl function of the assembler like this: REBOL [] ; So I could use SciTE to write this message fix-bl: func [block /local labels here label] [ labels: make block! 16 block-action: :fix-bl if debug? [print "=== Fixing binding and labels... ==="] parse block [ some [ here: subblock-rule (here/1: bind here/1 words) | 'label word! (here/1: bind here/1 words insert insert tail labels here/2 index? here) | ; Beginning of the added code 'here word! integer! ( here/1: bind 'set words ; This is why HERE needs two arguments here/3: here/3 + index? here ; Offset from position of this directive if (here/3 < 1) or (here/3 > 1 + length? block) [ error/with here "Offset out of bounds:" ] ) ; End of the added code | opcode-rule (here/1: bind here/1 words) | skip (error here) ] ] parse block [ some [ here: ['bra word! | 'brat word! | 'braf word!] ( if not label: select labels here/2 [error/with here "Missing label:"] here/2: label - index? here ) | opcode-rule | skip (error here) ] ] ] | |
BrianH: 14-Oct-2005 | Why not do both? Change 'label word! (here/1: bind here/1 words insert insert tail labels here/2 index? here) to 'label word! ( here/1: bind here/1 words set here/2 index? here insert insert tail labels here/2 index? here ) No, since it wouldn't be set at runtime, it wouldn't be recursion-safe. The only safe way to do that would be to replace every reference to a label other than the label directive and the literal branches with a constant value of its absolute offset, the one in the labels block. Doable, but awkward. | |
BrianH: 18-Oct-2005 | I found an advantage to the new opcode-always-first syntax of rebcode that hadn't occured to me before, while examining the source of the assembler. With the old assembly syntax, the binding of the opcodes to the internal rebcodes object was performed by a bind of the whole code block, and all subblocks (except fot the do blocks). This bind was performed to all words, including those used as arguments and variables. Because of this the assembly opcodes were essentially keywords that could not be used as variables or as the names of externally referenced values like the functions called by apply. This made it very difficult to integrate with external code. Also, since more opcodes are being added all the time, your parameters and other variables could end up converted to keywords in future revisions of the VM and your code could stop working. Now, all opcodes are the first word in a statement, no keywords are anywhere else in rebcode statements and the every statement starts with an opcode. The assembler is able to just bind the first word in each statement to the rebcodes object during the syntax check, and to simply reject any statement that isn't valid syntax, including invalid opcodes. You can even use the opcode words as variables in your code, or refer to external values by those names without any difficulty. This simplified syntax would be easier to execute as well. The implication of this is that rebcode is now a strict statement-based dialect, instead of an expression-based one like the do dialect. The advantage to this is that you can always tell where a statement begins, where it ends, and what it is operating on. This kind of code is easy to follow and quick to execute. It can be trickier to write though, as you have to decompose those expressions you are used to writing into their component parts. | |
Group: RT Q&A ... [RT Q&A] Questions and Answers to REBOL Technologies [web-public] | ||
BrianH: 3-Nov-2005 | Kru, one of the list of suggestions we compiled for rebcode was a BIND opcode. | |
Volker: 11-Dec-2005 | set w 'action bind w object getw value w | |
BrianH: 11-Dec-2005 | As for the question about rebcode binding, let me make it clearer: It would solve all of the object field retrieval problems in rebcode to have an opcode added that would be the equivalent to the IN native, or maybe BIND. You wouldn't need path evaluation to be added - you could just retrieve an object field word and use setw/getw with it. Yes, you can use apply, but it is very slow in comparison with opcodes. Working with object fields is a pretty basic operation that doesn't have any direct support in rebcode, and some have come to miss it, particularly those that use objects in data structures. I often use blocks for data structures when I can because of the context overhead of objects, but some are more used to thinking in object-oriented terms. Plus, there's all of those built-in object-based structures. Still, I suspect that many of these questions would go away if apply was faster :( | |
BrianH: 11-Dec-2005 | Yes, this bind-like opcode was one of the requests that we came up with when we were compiling a list of rebcode enhancements. Thank you for implementing many of the other enhancements on that list :) | |
Gabriele: 11-Dec-2005 | one solution is: >> f: rebcode [] [add.i x x] >> f': func [obj] [bind second :f obj f obj] >> probe f' context [x: 3] make object! [ x: 6 ] | |
BrianH: 11-Dec-2005 | (Still to Volker for this) By using in rather than bind, you save a set instruction. Of course if the "object" word refers to a word rather than an object, that advantage is less so because we will have to convert the word to its context like this: apply w bind? [object] apply w in [object w] getw value w But for that to work we would need a new rebcode alpha with the 2.6.2 enhancements. | |
Gabriele: 11-Dec-2005 | note that if speed is what you are after, this is likely to be the fastest way; if the object changes in a loop, then the rebcode advantage is probably not big, though i understand there may be cases in which a BIND or IN opcode would be desirable... | |
Group: Windows/COM Support ... [web-public] | ||
Graham: 3-Jun-2008 | Anton, can you see anything wrong with this ... crashes Rebol rebol [] ; download the skype4com dll from https://developer.skype.com/Docs/Skype4COM/Start ; and register the library ; regsvr32 skype4com.dll ; example of using sms ; https://developer.skype.com/Docs/Skype4COMLib/Sms_vbs COMlib: do %comlib.r COMlib/initialize do bind [ oSkype: CreateObject "Skype4COM.Skype" oSMS: GetObject [ oSkype ".SendSms( %s, %s)" "+12345679" "Hello!" ] ] COMlib/api This should send a SMS using the Skype installed on your PC. | |
Graham: 12-Jun-2008 | COMlib: do %comlib.r COMlib/initialize if error? set/any 'err try [ do bind [ oSkype: CreateObject "Skype4COM.Skype" if -1 <> res: GetInteger [oSkype "Client.IsRunning"] [ CallMethod [oSkype "Client.Start()"] ] cUserStatus_Offline: GetInteger [oSkype ".Convert.TextToUserStatus(%s)" "OFFLINE"] ] COMlib/api ] [ probe mold disarm err ] | |
Group: SQLite ... C library embeddable DB [web-public]. | ||
Ashley: 14-Mar-2006 | If someone has an SDK licence could they confirm this strange behaviour by replacing the last line of %sqlite.r with: attempt [delete %test.db] connect/create %test.db sql "create table t (c)" sql "insert into t values (1)" print mold SQL ["select * from t where c = ?" 1] wait 2 and encapping it with either enpro or enface. Run both the script and the encapped version and compare the output ... I get an empty block returned by any statement that makes use of bind variables and is encapped. DOing %sqlite.r from an encapped script works fine, as does something like: do uncompress #{789C... so my only guess is it's a binding issue of some sort. | |
Ashley: 16-Mar-2006 | Hmm, adding /direct to the example posted previously and changing the last part of the INSERT to "... form $1 1 form $1 * 1" seems to work properly (100 error-free runs so far). The *only* difference then is in this line of the value binding logic: unless direct [val: mold/all val] which if you change it to something like: unless direct [p: mold/all val] *bind-text sid i p length? p 0 seems to handle more runs before a failure. Thinking that mold/all might be the problem I then reran my /direct test with the following SQL statement: SQL reduce ["insert into t values (?,?,?,?,?)" 1 mold/all reform ["A" 1] mold/all $1 1 mold/all $1 * 1] which is functionally equivalent to the failing statement ... but no failures (after 100 runs). So, the conditions needed to reproduce this error [so far] are: SQLite library INSERT statement using a particular sequence of bind variables MOLD/ALL coded / used in a particular manner High volume of INSERTs Now is that an obscure error or what? ;) | |
Ashley: 17-Mar-2006 | But they are not the same way ... SQL "insert into t values ('text') SQL {insert into t values ('"text"')} map to: SQL ["insert into t values (?)" "text"] ; with /direct refinement SQL ["insert into t values (?)" "text"] ; without /direct refinement The first approach in each case is saying, "I want this value to be stored as a SQLite TEXT value which will not be LOADed upon retrieval"; while the second is saying, "I want this value to be stored as a MOLDed SQLite TEXT value which will be LOADed upon retrieval back into a REBOL string value (as opposed to the word 'text)". A string! statement is strictly literal, it is passed onto SQLite with no parsing or conversion. If you want to bind values, use the block form ... that's what it's there for! | |
Ashley: 25-Mar-2006 | 0.1.8 available at: http://www.dobeash.com/SQLite/sqlite.r Two main fixes are date bind value handling and concatenated string handling (both of which were posted previously as code snippets). | |
Ingo: 5-Apr-2006 | I got an error in the 'sql func ... ** Script Error: length? expected series argument of type: series port tuple bitset struct ** Where: switch ** Near: *bind-text sid i val length? the database is opened with /direct refinement. The call is: sql ["select * from person where guid = ?" guid1] Where I know, that the dataset with this guid exists, because I have just got it from another selsct. The dataset contains only strings, some of them empty. Well, this is it: ["h-o-h.org_20060326_182311691_1224" "Urte" "Hermann" "Urmeli" "" "" "" "" "" "" "" "" "" "" "Opera ID: 359" "" "" ""] And I am using the right guid. Any ideas? | |
Ingo: 5-Apr-2006 | So, the error in one small message: >> sql ["select * from person where guid = ?" #"a"] ** Script Error: length? expected series argument of type: series port tuple bitset struct ** Where: switch ** Near: *bind-text sid i val length? | |
Ashley: 7-Apr-2006 | If it's only TEXT types you need to encrypt then we could always add a /secure refinement to CONNECT that would force encrypt / decrypt on all TEXT bind variables. Performance wouldn't be too bad as values would only be encrypted [once] on INSERT and SELECT, the actual query (which could potentially hit millions of rows) would be comparing encrypted strings and would only need to decrypt strings that form part of the result set. Very similiar to the overhead that MOLD/LOAD currently incur when not using the /direct refinement. | |
Group: !REBOL3-OLD1 ... [web-public] | ||
Geomol: 5-Apr-2006 | ok, I see the difference. And I guess, it's benefitial, because using bind can be difficult. And your question is, if closure should have a third block with "cheap" initializations? | |
Geomol: 5-Apr-2006 | If the idea with closure is, that programmers having trouble with func (and feel going into using bind is difficult), then the more complicated syntax will also not be good, as you say. | |
Pekr: 6-Apr-2006 | As for my reply to closures, I am not that skilled to understand its immediate value - first example - what was difference to example using reduce? And couldn't the same be done with bind somehow? :-) | |
Group: Postscript ... Emitting Postscript from REBOL [web-public] | ||
Graham: 18-Apr-2006 | I guess I need to bind somewhere... | |
Group: Plugin-2 ... Browser Plugins [web-public] | ||
Dockimbel: 13-Oct-2006 | bind-extern CGI to [ .cgi .r ] | |
Dockimbel: 13-Oct-2006 | bind-extern CGI to [.cgi] | |
Group: !Cheyenne ... Discussions about the Cheyenne Web Server [web-public] | ||
amacleod: 1-Jun-2007 | Has anyone tested php on windows. And do I need to uncomment : ; bind fastcgi to [.php .php3 .php4] and :; extern fastcgi [ ; command "php -b $port" ; pool min 1 max 4 ; server 192.168.0.100 ; port 1234 ; root-dir "/home/dk/fcgi/" ; ] | |
Terry: 2-Jun-2007 | Ok.. PHP is running on XP.. uncomment this line in httpd.cfg bind fastcgi to [.php .php3 .php4] | |
Dockimbel: 12-Jun-2007 | Btw, mod-action provides a general purpose background tasks launcher, you could use it for making your first "bg handler". Here's a small sample code for implementing a bg task handler called "demo" : - Add in %httpd.cfg in globals section : bind-extern demo to [.dem] - Add %handlers/demo.r : REBOL [ Title: "DEMO handler" ] install-module [ name: 'demo on-task-received: func [data][ data: reduce load data wait 0:0:3 ; simulates a 3sec long processing result: reform [ ; you have to return the response string in 'result <html><body> "You're IP is :" data/ip </html></body> ] ] ] - Then create a fake %www/test.dem file (with any content, not used in this demo handler) - Launch Cheyenne and try : http://localhost/test.dem | |
MikeL: 18-Jun-2007 | Petr, Isn't this AddHandler the same as was demonstrated with the Demo.r which can be defined in the %httpd.cfg globals section bind-extern demo to [.dem] Add demo.r which in %handlers/ can do anything you like with the content? | |
Pekr: 18-Jun-2007 | so you think I could do: bind-extern pekr-rsp to [.html .htm] and then putting pekr-rsp.r into %handlers/ ? | |
Dockimbel: 5-Jul-2007 | bind fastcgi to [.php .php3 .php4] | |
Pekr: 5-Jul-2007 | modules [ ; userdir internal static action fastcgi rsp ssi alias ; embed ] globals [ bind SSI to [.shtml .shtm] bind fastcgi to [.php .php3 .php4] bind-extern CGI to [.cgi .r] bind-extern RSP to [.j .rsp] ; user nobody ; group nobody ] default [ root-dir %/c/!Docs-private/Xidys/cheyenne-r0914/Cheyenne/www/ default [%index.html %index.rsp %index.php] on-status-code [ 404 "/custom404.html" ] webapp [ virtual-root "/testapp" root-dir %www/testapp/ auth "/testapp/login.rsp" debug ] ; "/" [ ; redirect http://softinnov.org ; ] ; extern fastcgi [ ; command "php -b $port" ; pool min 1 max 4 ; server 127.0.0.1 ; port 1234 ; root-dir "/home/dk/fcgi/" ; ] ] ;rebol.si.org [ ; root-dir %//dev/si-org/old/ ; default %main.html ; ; redirect 301 "/mysql*" "http://si.org/rebol/mysql.shtml" ; redirect 301 "/rebox*" "http://si.org/rebol/rebox.shtml" ; redirect 301 "/" "http://si.org" ;] ; ### ; To add a new virtual host just duplicate and fill the following ; example host : ; ; my.vhost.com [ ; root-dir %/www/ ; documents root directory ; default [...] ; default files ; ] ; ### |
1 / 992 | [1] | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |