World: r3wp
[I'm new] Ask any question, and a helpful person will try to answer.
older newer | first last |
Anton 21-Jan-2008 [1248] | first line says "mu-word" :) |
SteveT 21-Jan-2008 [1249] | Dohhh! it's this eclectic keyboard lol |
Anton 21-Jan-2008 [1250x6] | 'my-word is therefore not in o1 and so: in o1 'my-word == none |
:) | |
first o1 first o2 | |
Lists the words in each object, if you don't believe what IN is telling you. | |
Or of course you can use HELP or ?. | |
? 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 [1295x3] | 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 ] ] | |
older newer | first last |