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

World: r3wp

[Core] Discuss core issues

Anton
14-Feb-2007
[7176]
ooh.. actually....
Henrik
14-Feb-2007
[7177]
1. it currently works but is clumsy, I think
2. "how was this function called ?" = yes
Anton
14-Feb-2007
[7178]
How about this:
>> f: func [/a /b][print mold second bind? 'a]
>> f/a/b
[true true]
:)
Henrik
14-Feb-2007
[7179x2]
there is something about that you don't know the actual function 
name inside the function? if only the refinements and their order 
could be managed.
testing...
Anton
14-Feb-2007
[7181x2]
That's right, since several words can refer to the same function, 
it has no "one" word.
(it also could be an anonymous function)
Henrik
14-Feb-2007
[7183]
well, that only brings up a block and the refinement order is still 
off, which would be a problem if your refinements have arguments
Anton
14-Feb-2007
[7184x2]
I see.
I think you must pass in the code which is used to launch the function 
as a function argument :)
Henrik
14-Feb-2007
[7186]
nasty!
Anton
14-Feb-2007
[7187]
yep :)
Henrik
14-Feb-2007
[7188x2]
I wonder how hard this would be to implement in a single function. 
Probably very hard if functions internally are unaware of refinement 
order
very hard = impossible :-)
Anton
14-Feb-2007
[7190x3]
Well, given a function
f: func [code /a /b][print mold second bind? 'a]
do append/only copy code: [f/b] code
--->  [[f/b] none true]
Since I've passed in the code to call the function, it knows how 
it was called, and the order of refinements. The refinements are 
listed in spec order in the function context though.
What's the actual application for this recursive function, by the 
way ?
Henrik
14-Feb-2007
[7193]
it's a file packing function. refinements are used to determine which 
files should be skipped and which files should be processed with 
other external functions
Anton
14-Feb-2007
[7194]
And why does it need to be recursive ? Recursing directories ?
Henrik
14-Feb-2007
[7195x2]
I use it in many places for slightly different purposes
yes
Anton
14-Feb-2007
[7197]
ok, so more an abstract general idea.
Ladislav
14-Feb-2007
[7198x2]
I think you must pass in the code which is used to launch the function 
as a function argument :)
 no need, pass-args can handle everything
, but a native APPLY handling refinements transparently would definitely 
help
Gabriele
14-Feb-2007
[7200x4]
Henrik: why is the refinement order important to you? (since there's 
no way to know it from inside a function)
if you have control over the function, write a (recursive) function 
without refinements and a wrapper with refinements that calls it. 
(this is the best solution)
if you don't have control over the function, Ladislav's pass-args 
or similar techniques are the most general way to solve the problem. 
easier/faster solutions may be available in specific cases.
a native APPLY would solve all of this elegantly... hopefully we'll 
get one :)
CharlesS
15-Feb-2007
[7204]
aye, I look forward to apply too :)
Robert
19-Feb-2007
[7205]
What does PATH do?
Rebolek
19-Feb-2007
[7206]
in immortal words of Kurt Cobain "who knows? not me."
and this probably won't help very much:
>> ?? a
a: make object! [
    b: 1
]
>> path a 'b
>> ?? a
a: make object! [
    b: end
]
Oldes
19-Feb-2007
[7207]
this is thee end...this is thee end my friend... (but that's another 
song..)
PeterWood
19-Feb-2007
[7208]
So what does end do?
Rebolek
19-Feb-2007
[7209x2]
I don't know. let's continue with the example:
>> type? a/b
== unset!
well, that's my fault, sorry
Oldes
19-Feb-2007
[7211]
Don't know what PATH does...
>> x: first [a/b/c/d]
== a/b/c/d
>> y: path x 'b
** Script Error: y needs a value
** Near: y: path x 'b
>> ?? x
x: a/b
Rebolek
19-Feb-2007
[7212]
hm I'm now lost even in REBOL. back to that terrible Perl/OLE combination 
:/
Robert
19-Feb-2007
[7213]
Can this routine (http://www.rebol.net/article/0281.html) for copying 
large files be used to transfer a file over a network as well?
Oldes
19-Feb-2007
[7214]
of course it can
Robert
19-Feb-2007
[7215x2]
Sounds good. What do I need to change? I'm really not a network expert 
nor a port expert.
because at the moment it only takes file! as argument. Does switching 
to url! is enough?
Oldes
19-Feb-2007
[7217x2]
but maybe not, I'm not sure how it's with the seek
just try to add url! into "from" argument and try it
Anton
19-Feb-2007
[7219]
It depends if the particular server supports resume. My batch-downloader 
manages to do resumes from most FTP sites I have tried.
Robert
19-Feb-2007
[7220x3]
Is it at rebol.org?
Does it support FTP login?
But FTP might have problems with corporate firewalls, right?
Anton
19-Feb-2007
[7223x3]
See
http://anton.wildit.net.au/rebol/util/batch-download.r
http://anton.wildit.net.au/rebol/util/demo-batch-download.r
It supports FTP urls. If the url can contain the login details, then 
it should be ok.
Sorry, my first comment above "resumes from most FTP sites" should 
be "HTTP sites". I've not widely tested it with FTP, only with a 
few FTP files Graham was using for his EMR project.