r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[Core] Discuss core issues

Gregg
28-May-2005
[1137x2]
The only time I use FOR today is when I need to:
	a) start at a number other than 1
	b) step by a increment other than one.
	c) brevity and clarity is more important than performance.
If REPEAT had /start and /skip refinements...
Romano
28-May-2005
[1139x2]
assume: func [
    {If a value is not in a series, append it.}
    series [series! port!]
    value
][
    any [find series value insert tail series :value]
]
I propose this new function for Core. check the return values in 
both cases.
ChristianE
28-May-2005
[1141]
As imho is the case with ALTER, ASSUME in my ears sounds too general 
to give a hint to it's functionality just by it's name. 

A function like the one you suggest seems very useful to me, though. 
How's about APPEND-ONCE (could even be APPEND/ONCE on mezzanine level).
BrianW
29-May-2005
[1142]
I'm losing my mind here ... my Linux rebol scripts just aren't working 
unless I invoke rebol directly myself.
Robert
29-May-2005
[1143]
debugging: IIRC I once asked this question already but can't remember 
the answer. Is it possible from inside a function to get the set-word 
this code is bound to? I would like to be able to print the set-word 
for debugging call-traces.
ChristianE
29-May-2005
[1144x9]
See the following mailing thread:
http://www.rebol.org/cgi-bin/cgiwrap/rebol/ml-display-thread.r?m=rmlGCNJ
You may use a redefined FUNC like
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]
    ]
]
>> a: b: c: func/name [x] [either none? x [print [self "called with 
X arg of value NONE"]][probe x]] 'my-func
>> a 0
0
== 0
>> a none
my-func called with X arg of value NONE
Might cause serious binding problems, though (I haven't tested it 
in any serious means). And it may probably not suit your needs exactly.
Thought about it twice. Doesn't make any sense, anyway: it has no 
benefits over printing "MYFUNC called with ..." directly.
Ammon
29-May-2005
[1153x2]
Yeah, that's going to have some binding issues.
But you have the right idea
Robert
29-May-2005
[1155]
Ok, than we should add better trace functionallity to Rebol :-))
Anton
30-May-2005
[1156]
I agree with Allen, but I would expect FOR to be able to handle variables, 
eg:
	for i [1 to 5][
		for j [i * 2 to i * 3 step 2][...]
	]
Ammon
31-May-2005
[1157]
What's the trick to getting the @ symbol into your username when 
checking POP mail in REBOL?
PeterWood
31-May-2005
[1158x2]
If you check the ML topic index  for pop, you'll find 


http://www.rebol.org/cgi-bin/cgiwrap/rebol/ml-display-thread.r?m=rmlFSJQ

http://www.rebol.org/cgi-bin/cgiwrap/rebol/ml-display-thread.r?m=rmlQGBQ

http://www.rebol.org/cgi-bin/cgiwrap/rebol/ml-display-thread.r?m=rmlQGBQ

Each of which contains the answer.
Which is :


 open [ scheme: 'pop user: "[[username-:-coxinet]]" pass: "password" host: 
 "pop.coxmail.com" ]
Ammon
31-May-2005
[1160x2]
Yup, found an email you sent to the mailing list  referencing this 
just before you posted here... ;~>
So you answered my question before I asked it.  That's pretty good. 
;~>
Allen
31-May-2005
[1162]
I'm curios as to why do people use @ in a username.? I thought the 
rfc said not to.
Ammon
31-May-2005
[1163]
In this case, ask Google why...
Graham
31-May-2005
[1164]
It's often because the ISP passes the user onto another pop server 
ie. the first proxies for the final pop server
DideC
1-Jun-2005
[1165]
Tiscali has bought many Provider in France. They handle email in 
@tiscali.fr, @freesbee.fr, infonie.fr ... with the same POP server 
(proxy?). So they need the full email as login.
Dockimbel
1-Jun-2005
[1166]
Does anyone know if REBOL runs on Windows CE.NET 4.2 ? I'd need to 
use REBOL on that platform but I don't have access to a CE.NET terminal 
and can't use an emulator because there's no REBOL WinCE x86 binary.
ChristianE
1-Jun-2005
[1167]
This probably is a silly question, but ... What is the benefit of 
DO GET IN OBJECT WORD over just writing OBJECT/WORD ? 

I see this a lot in VIEW source (e.g. in DO-FACE) and related guru 
sources. I really don't see the point of doing so, be there *must* 
be a reason. Anyone willing to educate me? Is this a path evaluation 
issue?
JaimeVargas
1-Jun-2005
[1168]
Maybe the word is dynamic?
ChristianE
1-Jun-2005
[1169]
Oh, sorry, typo here: should have read DO GET IN OBJECT 'WORD - it's 
LIT-WORD!, actually.

Of course, there *are* differences, e.g. OBJECT/WORD doesn't throw 
an error if WORD is unset. But I'm uncertain on the exact reason 
why that idiom is used.
JaimeVargas
1-Jun-2005
[1170]
Dynamic dispatch of code, if the slot exist.
ChristianE
1-Jun-2005
[1171]
Still don't get it. Both 


 do-face: func [face value][do get in face 'action face either value 
 [value] [face/data]]

 do-face: func [face value][face/action face either value [value] 
 [face/data]]

seem to work.
JaimeVargas
1-Jun-2005
[1172x3]
o1: context [
    init: [print "Init code for o1"]
    eval: [print "Eval code for o1"]
    end: [print "End code for o1"]
]

o2: context [
    init: [print "Init code for o2"]
    eval: [print "Eval code for o2"]
]

eval-obj: func [obj][
    do get in obj 'init
    do get in obj 'eval
    do get in obj 'end
]

eval-obj o1
eval-obj o2
In your example the face may not have an action slot.
Therefor throwing an error instead of graceful fail.
ChristianE
1-Jun-2005
[1175x2]
Oh, thanks, now it's all clear. I tried with setting WORD to any 
value I could image, but not with object without WORD. As always, 
so simple, so obvious! Thanks again.
Kind of obvious after someone makes it obvious to me, though ;-)
JaimeVargas
1-Jun-2005
[1177]
That seems to be the norm with Rebol. But we are so trained to look 
for complex explanations that we skip the path of less surprise.
BrianH
1-Jun-2005
[1178]
Plus, the behavior of object/word depends upon what datatype the 
word is set to and (for some datatypes) which version of REBOL you 
are running. If WORD is set to a block, OBJECT/WORD is the same as 
GET IN OBJECT 'WORD, while if WORD is set to a function, or sometimes 
a path or paren, it means DO GET IN OBJECT 'WORD. By spelling out 
what you want to do, you won't be as tied to variances in REBOL path 
evaluation and your code can be more general.
Gabriele
2-Jun-2005
[1179]
The real reason, most of the times, is what Brian says above: if 
you want to get a function value instead of evaluating it.
ChristianE
2-Jun-2005
[1180]
Yes, Gabriele, that's what I supposed it's all about, but since in 
the places I've seen it, the function weren't used as first class 
values, but rather evalutated. Jaime pointed me to another reason: 
the GET IN variant doesn't break if an object doesn't feature the 
wanted "slot". That really makes sense where code can't be too sure 
about the objects it handles.


Actually, though the guru code I mentioned was some of your changes 
to the view event- and modal system (I'm still working my way thru 
it, trying to understand it's pickier details) and other view related 
code snippets from cyphre, I'd really thought I'd better ask in core 
group, since it may come down to a more broader misconception of 
path evalutation I had. I'm happy to see that it's "only" the point 
Jamie made which I overlooked.
Gabriele
2-Jun-2005
[1181x4]
yes, the main point is that you are safer, whatever value is in the 
object. note that if the word is not available just using get in 
will break anyway in "older" versions.
>> system/version
== 1.2.8.3.1
>> obj: context [a: 1 b: 2]
>> get in obj 'c
** Script Error: get expected word argument of type: any-word
** Near: get in obj 'c
recent versions will not complain in this case (GET accepts NONE 
too)
i think in the VID case, the code is written that way so that it 
works correclty not only if face/action is a function, but also if 
it is a block (as it was in earlier versions of VID)
Guest
5-Jun-2005
[1185]
http: -> Circular forwarding is there any stable solution yet to 
avoid endless loops ? have tried to set different flaggs within the 
schemes object but can't  stop den endless loop. even read the messages-boards 
and found some hints but these doesn't work either. is there no flagg 
to set to prevend forwarding ? any hint are welcome... thanks
Gabriele
5-Jun-2005
[1186]
can you check port/locals/list? what do you get there?