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

World: r3wp

[I'm new] Ask any question, and a helpful person will try to answer.

PeterWood
15-Mar-2008
[1394x2]
>> c: func [a [function!]] [if 2 = length? first :a [print a 1 2]]
 
>> c :b
3
>> d: func [][print "no args"]
>> c :d

== none
JohanAR
15-Mar-2008
[1396x3]
Mm, I ended up writing something similar to that. Found out that 
I also have to check if third first :a is /local, which would also 
be a valid function
getargs: function [
	:fun "Get arguments from this function"
][
	out pblock
][
	out: make block! 10
	parse third :fun [
		some [
			string!		; Strip comments
			|

   [ [word! | get-word! | lit-word!] (pblock: [any-type!]) opt [string!] 
   opt [set pblock block!] opt [string!] (append/only out pblock) ]
		]
	]
	out
]
a little messy, but it appears to work :)
BrianH
15-Mar-2008
[1399x6]
You don't have to manually check to see if the function takes two 
arguments; this is good, because doing so is awkward. All you really 
need to do is call the function in parentheses ( ) or at the end 
of a code block, so that it can't take more than two arguments even 
if it tries. If it takes less than two arguments, who cares?
Be sure to assign the use or assign the result of the function call 
inside the parentheses, rather than outside them, in case the function 
takes less than the number of arguments you are expecting it to.
Do
    source replace
in REBOL 2.7.6 for an example of this - look for the parentheses.
The ARRAY function in 2.7.6 does the end-of-the-code-block method 
for function value arguments.
If the datatypes the function value is expecting don't match the 
data that your function is passing to it, no problem: A nice error 
message will be generated at runtime that the developer of the function 
value can use to fix their function value. :)
assign the use
 -> "use"
Gabriele
16-Mar-2008
[1405]
Carl had a nargs mezz somewhere (maybe he posted it on the ml?)
Gregg
17-Mar-2008
[1406]
http://www.fm.tul.cz/~ladislav/rebol/argstake.html
RobertS
23-Mar-2008
[1407]
; what is the rationale, I wonder of the difference
>> lit-word? first [ 'thang thing]  
== true
>> lit-word? 'thang
== false
>> type? first ['thang thing]
== lit-word!
>> type? 'thang
== word!
BrianH
23-Mar-2008
[1408]
type? first ['thang]
'thang is not being evaluated

type? 'thang

'thang is being evaluated. The result of that evaluation is a word!
Sunanda
23-Mar-2008
[1409]
.....But with 'reduce, 'thang is being evaluated, so:
    type? first reduce ['thang]
    == word!
RobertS
23-Mar-2008
[1410]
thang -ks
Henrik
26-Mar-2008
[1411]
I can't believe I missed all those REBOL tutorials available on Youtube 
by Nick Antoniacco. Here's the complete list, in case newbies missed 
them too:

http://musiclessonz.com/rebol_video_links.html
Reichart
26-Mar-2008
[1412x2]
Interesting guy http://rockfactory.us/Teachers.html
He is the top one "Nick"
Gregg
27-Mar-2008
[1414]
Didn't RT link to those from REBOL.com at some point? If not, they 
really should.
Will
27-Mar-2008
[1415]
looking at source of 'send, am I right, if there is an error executing 
send, than the port is not closed, this will leave a lot of open 
connections when batching?
BrianH
27-Mar-2008
[1416]
Ports are closed when the garbage collector gets them. If you are 
batch sending, the next time you call the SEND function it will assign 
none to the smtp-port local variable, rendering the previous reference 
assigned to that variable into garbage. The next time RECYCLE is 
run, any open ports in the garbage will be closed.
Will
27-Mar-2008
[1417x2]
ok, but between recycles, I could reach the maximum connections limit 
of the smtp server?
also, 'send should probably return a value of type logic!
BrianH
27-Mar-2008
[1419]
Recycle yourself if you're worried. Interesting idea on the return 
value.
Will
27-Mar-2008
[1420x7]
Thanks BrianH, I'm trying to find a bug, I get random port none not 
open errors but they appear randomly everywhere, only thing sure 
is they come only after using 'send , but it may be word! conflict, 
variable rewrite, etc.. just maybe someone has a better idea where 
to look for.. 8/
looks like an asynchronous event error popping in the middle of execution 
of other code, possible??
like this error:
code: 501
description: access error, Port none not open
near:
[if none? i [return none] 
either
]
where: confirm

or

code: 501
description: access error, Port none not open
near:
[if empty? block: reduce block]
where: confirm


oly thing in common, is where: confirm and that I see only in net-utils, 
any idea ?
even had a recycle..
code: 501
description: access error, Port none not open
near:
[recycle 
wait 0.2
]
where: confirm
here is the net-log, a couple of this (no problem)::

Net-log: ["Opening" "tcp" "for" "esmtp"]
Net-log: [none "220"]
Net-log: "220 domain.com running core"
Net-log: [["EHLO" system/network/host] "250"]
Net-log: {250-domain.com hello mail.local (10.5.32.4)}
Net-log: "250-PIPELINING"
Net-log: "250-8BITMIME"
Net-log: "250-BINARYMIME"
Net-log: "250-CHUNKING"
Net-log: "250-ENHANCEDSTATUSCODES"
Net-log: "250-ETRN"
Net-log: "250-AUTH CRAM-MD5 DIGEST-MD5 NTLM PLAIN LOGIN"
Net-log: "250 SIZE 2147483647"
Net-log: ["Supported auth methods:" [cram plain login]]
Net-log: ["MAIL FROM: <[majordomo-:-domain-:-com]>" "250"]
Net-log: "250 2.1.5 sender OK"
Net-log: ["RCPT TO: <[user-:-domain-:-com]>" "250"]
Net-log: "250 2.1.0 forwarding to [user-:-domain-:-com]"
Net-log: ["DATA" "354"]
Net-log: "354 send your message"
Net-log: [none "250"]
Net-log: "250 2.6.0 message received OK"
Net-log: ["QUIT" "221"]
Net-log: "221 2.0.0 domain.com closing connection"
than suddenly this one:

Net-log: ["QUIT" "221"]
Net-log: ["Opening" "tcp" "for" "esmtp"]
Net-log: [none "220"]
Net-log: "220 domain.com running core"
Net-log: [["EHLO" system/network/host] "250"]
Net-log: {250-domain.com hello mail.local (10.5.32.4)}
Net-log: "250-PIPELINING"
Net-log: "250-8BITMIME"
Net-log: "250-BINARYMIME"
Net-log: "250-CHUNKING"
Net-log: "250-ENHANCEDSTATUSCODES"
Net-log: "250-ETRN"
Net-log: "250-AUTH CRAM-MD5 DIGEST-MD5 NTLM PLAIN LOGIN"
Net-log: "250 SIZE 2147483647"
Net-log: ["Supported auth methods:" [cram plain login]]
Net-log: ["MAIL FROM: <[admin-:-domain-:-com]>" "250"]
Net-log: "250 2.1.5 sender OK"
Net-log: ["RCPT TO: <[user-:-domain-:-com]>" "250"]
Net-log: "250 2.1.0 forwarding to [user-:-domain-:-com]"
Net-log: ["DATA" "354"]
Net-log: "354 send your message"
Net-log: [none "250"]
Net-log: "250 2.6.0 message received OK"
Net-log: ["QUIT" "221"]
Net-log: "221 2.0.0 domain.com closing connection"


error code: 501
description: access error, Port none not open
near: [value: either series? :value [copy value]]
where: confirm
note the difference that seams to trigger the problem is the first 
line, the 'quit, where does it come from?
Gabriele
28-Mar-2008
[1427x4]
;-- Send as an SMTP batch or individually addressed:
        smtp-port: open [scheme: 'esmtp]
        either only [ ; Only one message to multiple addrs
                address: copy address
                ; remove non-email values
                remove-each value address [not email? :value]

                message: head insert insert tail net-utils/export header-obj newline 
                m
essage
                insert smtp-port reduce [from address message]
        ] [
                foreach addr address [
                        if email? addr [

                                if not show [insert clear header-obj/to addr]

                                tmp: head insert insert tail net-utils/export header-o
bj newline message

                                insert smtp-port reduce [from reduce [addr] tmp]
                        ]
                ]
        ]
        close smtp-port
the port is closed in the last line of send - am i missing something?
it may not be closed in case of errors, but as Brian said, the GC 
will catch that eventually (though maybe we should TRY and rethrow 
the error)
about the above error - it may be an out-of-order event indeed. now 
the problem is finding a simple way to reproduce it.
SteveT
28-Mar-2008
[1431]
Hi Henrik, I found Nicks youTube tutorials to be very useful when 
I was searching for stuff. Great help!
Reichart
28-Mar-2008
[1432]
I'm inviting a friend of mine here, he is another brilliant langauge 
designer, I'll invite him as Fork (his real name is Brian, but we 
have enough Brians around here.
BrianH
28-Mar-2008
[1433]
We're taking over :)
Graham
28-Mar-2008
[1434]
Call him Brain instead ...
BrianH
28-Mar-2008
[1435]
That would conflict with even more people here :)
Anton
28-Mar-2008
[1436]
Where ?
btiffin
29-Mar-2008
[1437]
Go Brians Go
RobertS
29-Mar-2008
[1438x2]
so is this in a REBOL Survival Guide somewheres?
{  from guys on CORE }
is as good as
comment { 
so is this in a REBOL Survival Guide somewheres?
}
feelin' foolish as another 'good' idea meets my second cuppa java
JohanAR
29-Mar-2008
[1440]
have to be careful with using { ... } to comment things out though.. 
I wanted to teporarily remove a block of code from a function, but 
I didn't think of that it was the last part of the function so the 
string got returned instead of the real value I wanted :)
RobertS
29-Mar-2008
[1441x3]
ODE
so I though mebbe
;{
 which would only end at a
;}
as }; will not do ...
To take a page from Snobol

  both would have to be unindented, i.e., occupy first and second char 
  of the line

I live in curly-brace land in CURL and a missing brace becomes a 
headache even in a editor with a scroll-u-there brace-matcher
I try never to repress my silly ideas as some have been winners (time 
and $$$ for my employers, true ... but all the same )
It does mean messing with the shift key which is un-rebolish
But I can't see suggesting
;[
block-comment code falls in here
;]
In CURL we have tag-matching using
|tag-this#
there will not be a duplicate tag until we reach
#tagthis|
|| where |# until #| are vulnerable

|| I ask developer sto single line comment with double-bars but someone 
has to use
|# multi-line comment on a single line to show they know how #|