World: r3wp
[I'm new] Ask any question, and a helpful person will try to answer.
older newer | first last |
Anton 21-Jan-2008 [1255] | ? o1 ? o2 |
SteveT 21-Jan-2008 [1256] | Think I understand that |
Anton 21-Jan-2008 [1257] | Each word carries its binding with it. ie. a reference to an object. (or no object if it is unbound). |
SteveT 21-Jan-2008 [1258] | Can you get problems if an object gets bound to itself? |
Anton 21-Jan-2008 [1259x2] | An object is a container of word -> value pairs. When you ask for a word's value, the word's binding is checked to get the object. |
An object cannot be bound to anything. Only words can be bound. | |
SteveT 21-Jan-2008 [1261] | Sorry that's what I meant 'Word' |
Anton 21-Jan-2008 [1262x2] | A word isn't really a binding target, so you can't bind a word to itself (or any other word.) |
(BIND accepts a known-word argument. It is the *object* that the known-word is from, not the known-word itself, which is the target for the bind.) | |
SteveT 21-Jan-2008 [1264] | Right - the context it's from ???? |
Anton 21-Jan-2008 [1265x2] | Correct. (context = object). So my above example could be modified to: append code bind [my-word] in o3 'self which is in fact how we used to have to do it, because BIND didn't have object! in list of accepted types for its known-word argument. |
so these are all the same: append code bind [my-word] o3 append code bind [my-word] in o3 'self append code bind [my-word] in o3 'my-word (we would use the 'self word because it's in every object by default.) | |
SteveT 21-Jan-2008 [1267] | The order of execution throws me more than anytihing I would have had to do your code like this code append bind(my-word etc) I'm so used to starting with the item |
Anton 21-Jan-2008 [1268x2] | Are you an ex-forther or something ? |
(sorry, don't mean to sound rude...) | |
SteveT 21-Jan-2008 [1270] | No VB, C'# You tent to start with the object and then using . notation you tell it what action to take on it. |
Anton 21-Jan-2008 [1271] | Ah of course. Much better this way :) |
SteveT 21-Jan-2008 [1272x2] | Rebol you say what you want to do then which object you want to do it to lol |
As I said on my blog I'm just entering my second week of de-programming ;-/ | |
Anton 21-Jan-2008 [1274] | .. rebol is like: VSO = Verb Subject Object VB, C# is like: SVO = Subject Verb Object and Yoda is : OSV |
SteveT 21-Jan-2008 [1275] | Yeah your mind get comfortable one way or the other - takes a lot of breaking |
Anton 21-Jan-2008 [1276x2] | So actually rebol is less like english in that respect. But actually english is crazy. It's better to have the verbs at the front. |
Actually rebol has objects and path notation, so you SVO too. eg. ctx-text/unlight-text | |
SteveT 21-Jan-2008 [1278] | Yes that's where English is wierd for people to learn English say Bus Station Spanish say Station de Autobus perhaps i should Rebol in spanish ;-) |
Anton 21-Jan-2008 [1279] | If you think it would help :) I let you investigate and report your findings :) |
SteveT 21-Jan-2008 [1280x2] | :) |
Thanks for the help Anton brb | |
Anton 21-Jan-2008 [1282] | no prob |
Gregg 21-Jan-2008 [1283x2] | You can use the same kind of notation in REBOL as you would in VB, but using / instead of .(dot). It's called path notation in REBOL, and is used many places (objects, path types, refinements, etc.). Sometimes it's easier or clearer to write things one way or the other. |
Also, in VB there is the WITH statement (USING in C# I think). In REBOL, you can write your own like this: with: func [object block] [ if object [do bind/copy block in object 'self] ] | |
SteveT 21-Jan-2008 [1285] | Hi Gregg, yes I've used it a lot with refinements. Like I said I think French or Spanish speakers will think in the same order as Rebol ;-\ |
Gregg 21-Jan-2008 [1286] | >> obj: context [val: none prn: does [print val]] >> with obj [val: 2 prn] 2 |
BrianH 21-Jan-2008 [1287] | Gregg, your code is more complex than it needs to be. Try this: with: func [object [any-word! object! port!] block [block!]] [ do bind/copy block object ] This is unnecessary in R3, where you can use DO IN instead of WITH. |
Gregg 21-Jan-2008 [1288x4] | Thanks! |
Doesn't work on older versions of REBOL. Support for object came more recently. | |
Object as the known-word arg to BIND. | |
I might also have done mine the way I did to support the case when an object is NONE. Can't recall for sure. | |
PeterWood 22-Jan-2008 [1292x2] | Henrik: I believe that Rebol does have real inheritance, it's just based on protoytpes not classes: >> a: make object! [b: func[][print "I'm from object a"]] >> c: make a [] >> c/b I'm from object a >> d: make a [e: func [][print "I'm an extension to a"]] >> d/e I'm an extension to a >> f: make d [b: func [][print "I'm not the one in a"]] >> f/b I'm not the one in a |
This even gives an inefficent way of extending an object: >> a: make object! [b: func[][print "I'm from object a"]] >> a: make a [c: func[][print "My new method"]] >> a/b I'm from object a >> a/c My new method | |
SteveT 23-Jan-2008 [1294] | Hi All, In a list you have the 'first mylist/picked' is this not available for 'choice' ? |
Anton 23-Jan-2008 [1295x4] | Check index? face/data. |
Actually, there are access functions. So use get-face and set-face. | |
view layout [ size 200x300 ch: choice "one" "two" "three" [ print [index? face/data mold face/data] probe get-face face ] ] | |
Mmm.. set-face is not implemented fully. Use this: layout [my-choice: choice ...] set-face my-choice my-choice/text: "two" (we have to update the face/text ourselves.) | |
SteveT 23-Jan-2008 [1299] | Hi Anton, sorry for slow rep, just drove to London. Sorry I asked the wrong question there. What I was after was the 'index' of the the item chosen! |
Anton 24-Jan-2008 [1300] | No problem. |
SteveT 25-Jan-2008 [1301] | Journal of a 'Newbie' by SteveT ------------------------------------------- Hi all, second week of using Rebol. had to travel to London this week so you guy's have had less 'Noise' from me ;-/ Had some good help off Anton/Henrik with regard to trapping key-presses. I'm hoping that some of the properties (refinements) missing from R2 will be in R3 - things like forcing case.. I'm getting to grips with 'PARSE' will be great if the proposed lecture comes off. Still struggling with 'BIND' but I think I've learned enough about PARSE, BIND, CONTEXT & DIALECTS, to start using some of these facilities in some apps. Biggest lesson so far this week has been 'Don't use it just because it's there!' Stepping back from some of the things I've tried have lead me to simplifying my app rather than achieving a complicated solution! Happy trails... SteveT |
btiffin 25-Jan-2008 [1302] | Congrats Steve; I didn't even look at BIND for, well umm, yet. :) Don't learn too fast or I'll have to think about rewriting http://www.rebol.org/cgi-bin/cgiwrap/rebol/art-display-article.r?article=lf019t Then again; that article uses Sunanda's rebol.org Mini Wiki (miki) feature so feel free to update it. :) |
SteveT 26-Jan-2008 [1303] | Hi Brian, that's brilliant !! I said I wanted to get productive with REBOL by the end of January! But I didn't say which January - did I ;-/ Think I'm entering level 5 !!!! I'm definately 'confused from Blackpool' :) |
Henrik 26-Jan-2008 [1304] | I hope you can see that REBOL has amazing depth :-) |
older newer | first last |