Hi,
I can't say I completely get this either. But for do/args it only works
for scripts. And it always sets system/script/args
>> help do
<snip>
REFINEMENTS:
/args -- If value is a script, this will set its system/script/args
arg -- Args passed to a script. Normally a string. (Type: any)
It's one of those things that takes some getting used to, but it is design
intent. And command line arguments, are best accessed through
system/options/args, but will show up in those other places as one big
string. system/script/parent...isn't set for my Linux version with scripts
that are started up with REBOL.
When you were playing with /something in REBOL it becomes a little weird too.
/anything is a valid REBOL value. It can be passed around, set to variables
etc. a: /abc help a A is a refinement of value: /abc
So if you mistype or misplace an actual refinement, it is just a value (as are
real refinements in the "right" place but in that case the function header
parser does a few other things for you when it detects a "match").
/abc: "test" is a weird one. It will become pretty hard to retrieve without
looking into get and to- functions, maybe some other wierdness. There are a
few REBOL guru's that may explain what's going on.
And yep, it can get confusing as you try and figure out what the lexical
scanner is actually up to sometimes.
Again, hope that helps a little.
Cheers,
Brian
On Saturday 28 July 2007 21:12, Jonathan Kelly wrote:
> Hi,
>
> I can't seem to get args working?? I'm running View 1.3.2.3.1 (Windows)
>
> Well, I thought before I posted I should check google and found the FAQ
> entry. I had mis-read the help text and was using
>
> do %t6.r /args "test1 "test2"
>
> but there was no error, which seems strange. So what is /args in that
> expression? Is it a work, but words can't contain the / character. Hmmm
> what does this mean ...
>
> >> /args: "testing"
>
> == "testing"
>
> >> /args
>
> == /args
>
> >> print /args
>
> args
>
> >> print mold /args
>
> /args
>
> >> help /args
>
> /args is a refinement
>
>
> Anyway, there seems to be some discrepancy anyway.
>
> When I run a script via "rebol t6.r test1 test2", I can see the args in
> three places:
>
> system/script/parent/args => "test1 test2"
> system/script/args => "test1 test2"
> system/options/args => [ "test1" "test2" ]
>
> OK, that's good, but what is the script's parent? (the interpeter?)
>
> So, now I want to run this script from another script (or the console).
>
> do/args %t6.r "test1 test2"
>
> the only args that is set is
>
> system/script/args
>
> and that hardly seems simple. But more; when I do
>
> xx: load %t6.r
> do/args xx "test1 test2"
>
> NONE of the args is set.
>
> t6.r is ...
> ------------------
> REBOL [
> Title: "Testing running scripts"
> Date: 29-Jul-2007
> File: %t7.r
> Author: "Jonathan Kelly"
> Version: 0.0.1
> ]
>
> print [ "A" type? system/script/args mold system/script/args ]
> print [ "B" type? system/options/args mold system/options/args ]
> print "T6 system/script"
> print mold system/script
> print "T6 system/options"
> print mold system/options
> ask "finished"
--
To unsubscribe from the list, just send an email to
lists at rebol.com with unsubscribe as the subject.