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

World: r3wp

[Core] Discuss core issues

Anton
16-May-2005
[1113]
Or maybe better to check   port/state/flags  or  port/sub-port/state/flags 
...... <---- need to investigate
Anton
19-May-2005
[1114x4]
Ahh... Best way might be to try to open port:
port: make port! http://www.rebol.net

print either error? try [open port]["open -> open"]["closed -> open"]
What's the best way to rethrow an error that you have caught and 
disarmed ?
;Like this ?
port: make port! http://www.rebol.net

if error? err: try [open port][err: disarm err throw make error! 
reduce [err/type err/id]] ; do this line twice
Romano
19-May-2005
[1118]
try:
>> errd: disarm err: try [ 2 / 0] errd/near: [new-near] err
** Math Error: Attempt to divide by zero
** Near: new-near
Volker
19-May-2005
[1119]
'disarm makes a copy. just throw the original error.
Henrik
19-May-2005
[1120x2]
is there an easy way to pad zeros on time! values? as in 04:17:00 
rather than having 4:17 displayed
never mind, I figured one out. it was of course simpler than I thought 
:-)
Gabriele
20-May-2005
[1122]
henrik, try out to-itime in the new 1.2.108
Henrik
20-May-2005
[1123x2]
was this added on my request? :-)
because it does exactly what I need
Gabriele
20-May-2005
[1125]
:-)
Brock
20-May-2005
[1126x2]
>> to-itime/precise now/time
== "06:39:2.0"
should this not have returned  "06:39:02.0"
sqlab
20-May-2005
[1128]
bad
>> to-itime/precise now/time
== "13:47:0.0"

worse
>> to-itime/precise now/time/precise
== "13:46:4E-2"
Gregg
27-May-2005
[1129x3]
For Post 1.3 discussion (moved here from the Debug 1.3 group) ...


What would your "perfect" FOR interface look like (anyone and everyone)? 
For me, I want it to hide the mechanical details more than CFOR does, 
and is nicer to read than the current FOR (for i 1 9 1 [...]). It 
might look like this:

for [i: from 1 to 9]	[...]
for [i: 1 .. 9 step 2]	[...]
for [i from 1..9 step 3]	[...]
for [i: 1 — 9 step 4]	[...]
for [i 0 to 1 step .1]	[...]

or maybe move the word outside the block:

for i [1 to 9]		[...]
for i [1 to 9 step 2]	[...]


Python has an Else clause, though it works backwards from what I 
expect it to; the idea is to have a clause that executes if 'break 
is used. It also has a Continue op that jumps to the head of the 
body for the next iteration.
I agree with Volker and Ladislav about the value of getting the stepping/increment 
code out of the body. I agree so much, I think it should be hidden 
entirely. :-)
The most common case, by far, is to step by one, so you should be 
able to omit that IMO.
Volker
28-May-2005
[1132]
cfor is not only about counting, but about anything like a "step". 
it may be counting, or stepping through a list by pos: next pos, 
or whatever. that can't be captured by better hiding.
Allen
28-May-2005
[1133x2]
Gregg: said "The most common case, by far, is to step by one, so 
you should be able to omit that IMO. " , for the most common situations, 
you would use REPEAT or LOOP. I virtually never use FOR, except if 
I'm thinking in some other language
for me, FOR is only there when one of the native looping structures 
doesn't suffice. 

But I do like then dialect options you present. My pref would be 
to keep the value outside (to keep closer to foreach syntax)., 
ie  for i [1 to 9 step 2][..]
Gregg
28-May-2005
[1135x4]
I rarely use it myself Allen. The only reason I really think it's 
important at all is that new people coming to REBOL will look for 
FOR. Need to add a doc section on native verus mezz control functions.
Volker, it should operate on series values as well, like FOR does 
today. My examples are all numbers, because that's easier to do concisely. 
:-)
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.