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

World: r3wp

[!REBOL3]

Anton
15-Sep-2010
[4922]
(Did they really? -- Gosh...)
amacleod
15-Sep-2010
[4923]
Would COMLib allow me to mess with internet explora...for example: 
insert urls into the address bar to change the website viewed without 
having to open another tab or window?
Maxim
15-Sep-2010
[4924]
in theory yes.
Henrik
17-Sep-2010
[4925]
Dumb question: How is it that I solve this?

>> set to-word "a" 2
** Script error: a word is not bound to a context
** Where: set
** Near: set to-word "a" 2
Rebolek
17-Sep-2010
[4926]
There's probably some easier way than this, I hope:

>> x: 1
== 1
>> set bind to word! "a" 'x 2
== 2
>> a
== 2
Henrik
17-Sep-2010
[4927]
ok, thanks
Maxim
17-Sep-2010
[4928x2]
wow rebol has become perharps a bit too picking about binding?

did someone forget that REBOL is supposed to be "simple" ?
picking = picky
ChristianE
17-Sep-2010
[4930]
LOAD loads and binds strings except being told otherwise with /UNBOUND:

>> set load "a" 2
== 2
>> set load/unbound "a" 2
** Script error: a word is not bound to a context
** Where: set
** Near: set load/unbound "a" 6

I don't think it's especially picky the way this is.
Maxim
17-Sep-2010
[4931x3]
I understand how it is... its just that in R2 to-word bound things 
to "global" context by default.
because we now have unbind and generally much more control over the 
binding, I would have thought that auto-binding to user context wouldn't 
be such a big issue.
it used to be an issue because we could not unbind.
ChristianE
17-Sep-2010
[4934]
May I withdraw my suggestion? Don't use is in tight loops:

>> dt [loop 100000 [set load "a" 2]]
== 0:00:02.017813

>> dt [loop 100000 [set bind to word! "a" 's 2]]
== 0:00:00.079424
Maxim
17-Sep-2010
[4935]
hehe
ChristianE
17-Sep-2010
[4936]
;-)
Henrik
17-Sep-2010
[4937]
well, then there has to be a better way to do that. some kind of 
default-bind.
Maxim
17-Sep-2010
[4938]
I just discoverd this func...    

utf?

in some fonts the u looks like a w... hehehe
Andreas
17-Sep-2010
[4939]
set bind/new to word! "a" self 2
or
set bind/new to word! "a" system/contexts/user 2
Gregg
17-Sep-2010
[4940x2]
Max, it's a dialect: 'ut th' fu'?

Though perhaps we could have a WTF? error-related func.
A refinement for SET might be very handy for the unbound scenario, 
and BrianH may chime in with the design logic to help clarify.
Maxim
17-Sep-2010
[4942]
yes.... wtf? as a small undocumented easter egg could be a nice little 
rebol detail   :-D   

basically it could be an alias for why?
Gregg
17-Sep-2010
[4943]
Maybe combined with a stack dump? That is, when you say WTF? you 
need all the help you can get. And the refinement for even more info 
would be /!. ;-)
Maxim
17-Sep-2010
[4944]
we should find refinements for:

WTF?/$/!/@/*/

;-)
Henrik
17-Sep-2010
[4945]
hmm... refinements are case sensitive?

>> txt
== [Errors: 0 Warnings: 0 Outputs: 1 Skipped: 0]

txt/errors
== 0

txt/Errors
== none
ChristianE
17-Sep-2010
[4946x3]
That is very strange and makes me wonder why I haven't been tripped 
by this BTW, you're talking path notation here not refinements. With 
function refinements it seems to work as expected.
>> test: func [/a] [all [a 'a]]
>> test/a
== a

>> test/A
== a
>> test: [a 1 A 2]
== [a 1 A 2]

>> test/a
== 1

>> test/A
== none


This is dowright unexpected, I'd consider it a bug, what do you think? 
You'd better curecode this, I guess.
Graham
17-Sep-2010
[4949x2]
probably never tripped by it because no one uses upper case refinements!
Looks like no one has posted this to curecode yet
PeterWood
17-Sep-2010
[4951]
MAx: "did someone forget that REBOL is supposed to be "simple" ?"

Did you miss this blog:  http://www.rebol.com/article/0374.html

Simplicity is a thing of the past.
Maxim
17-Sep-2010
[4952]
hehe
Graham
17-Sep-2010
[4953x2]
I thought that was not a good post myself ...
People use things at different levels of expertise ... and if there 
are enough experts around to critique their work, they will get better. 
 So, the differing programming styles seen are a reflection of Rebol's 
failure.
Gregg
18-Sep-2010
[4955]
Simple things should still be simple.
Graham
18-Sep-2010
[4956]
And complex things are complex
Gregg
18-Sep-2010
[4957]
As long as they're possible. :-)
Henrik
19-Sep-2010
[4958x2]
is there a function to recursively delete a directory? I should probably 
have asked before I wrote one. :-)
Otherwise, here is one, feel free to optimize:

delete-dir: func [dir /only criteria] [
	dir: clean-path dir
	foreach file read dir [
		if any [not only do func [file] criteria file] [
			file: dir/:file
			if dir? file [delete-dir file]
			delete file
		]
	]
]
Gregg
19-Sep-2010
[4960x2]
Optimizing file deletes means first avoiding the standard DELETE 
func. It reads the dir each time which can kill you if you have a 
large dir or, heaven forbid, point it at an FTP location. You can 
build on CLEAR easily though.

    delete-all-files-in-dir: func [dir /local port] [
        port: open dir
        clear port
        close port
    ]


I think my tree deleters all rely on some of my other stuff, like 
FILE-LIST and DO-IN-DIR (now standard as IN-DIR). They generally 
have a callback option as well, so you can track progress.
R3 may be different as I see it's an action now.
Chris
19-Sep-2010
[4962x4]
I have a version that redefines delete that I wrote for QM: http://www.ross-gill.com/r/brutal-delete.html


It has an optional /pare refinement that deletes empty parent folders 
too.
It's defined only to take URLs (as QM doesn't access files directly) 
but I think should work adding a file! argument.
Also not sure if it works the same way with R3 file ports.
Nup, guess not:
** Script error: cannot use clear on port! value
Andreas
19-Sep-2010
[4966x3]
Interesting. I think that's a bug, as CLEAR's spec is as follows:

clear: make action! [[

    {Removes all values. For series, removes from current index to tail 
    and returns tail.  (Modifies)}
    series [series! port! map! gob! bitset! none!]
]]
Well, guess it's just the error message that is misleading, as CLEAR 
still works on file ports.
(Not on directory ports, though.)
Chris
19-Sep-2010
[4969x2]
That explains it.  Wonder why not?
I guess 'remove doesn't either.
Andreas
19-Sep-2010
[4971]
I think it's basically "just not implemented". :)