World: r3wp
[Core] Discuss core issues
older newer | first last |
Sunanda 17-Jun-2010 [17083] | Sortability and sort order are (in REBOL) distinct from comparability. See this curecode report and the response for example: http://curecode.org/rebol3/ticket.rsp?id=1150 |
Ladislav 17-Jun-2010 [17084] | in the #1150 the response is missing the point, as I see it, mistaking #[datatype! unset!] and #[unset!] |
Endo 17-Jun-2010 [17085x2] | sort order for different datatypes is a more complex issue, but comparing pair to pair should be consistent with sort I guess. |
I mean = 4x3 4x3 >> true < 4x3 4x3 >> error | |
Ladislav 19-Jun-2010 [17087] | What do you think about this: >> even? 2.1 == true As far as I am concerned, I would call it a bug, since 2.1 does not look like an integer multiple of 2.0 to me. |
Robert 19-Jun-2010 [17088] | bug |
Fork 19-Jun-2010 [17089x3] | Unsure if it's a bug or I'm not getting something: http://stackoverflow.com/questions/3068467/why-cant-i-bind-things-like-email-in-the-global-context-on-interpreter-startup |
In the VM I'm running, AltME messed up the link again after email-in-t. | |
If anyone using this language actually cares about communicating with other beings - the Rebol tag on Stackoverflow is a feed you can add to your reader - http://stackoverflow.com/feeds/tag?tagnames=rebol&sort=newest | |
BrianH 19-Jun-2010 [17092] | Answered. |
Ladislav 19-Jun-2010 [17093x2] | hmm, another reason why not to manipulate words using strings; if you used words, you would not have observed any strangenesses |
what needs to be answered is *why* you had to (?) use the string? | |
BrianH 19-Jun-2010 [17095] | Yes he would have - the problem was independent of using the string. But it would have been less obvious if he had used a word from the beginning. Good opportunity for an object lesson though: He was asking about a "global context" in R3. |
Ladislav 19-Jun-2010 [17096x2] | >> is-email-addr: get bind 'email? bind? 'system |
(just works, no strangenesses) | |
BrianH 19-Jun-2010 [17098] | Ah, but that is assuming that the code is run at the top level. Judging by that particular code snippet, it looks like something from inside a function, and one that is likely in a context has 'email? already defined. Still, the fact that INTERN is already run on normal scripts (and the module equivalent run on modules) means that he likely wouldn't need to do this with the main contexts, just inner contexts. |
Ladislav 19-Jun-2010 [17099] | did you mean this? >> f: func [/local email?] [is-email-addr: get bind 'email? bind? 'system] >> f |
BrianH 19-Jun-2010 [17100] | Yeah, something like that. I added a question about using words instead of strings. |
Ladislav 19-Jun-2010 [17101] | so, I have to insist, that everybody using strings instead of words deserves every disaster he gets for not adhering to documented "best practices" |
BrianH 19-Jun-2010 [17102] | Those who don't use LOAD are condemned to reinvent it, badly :) |
Fork 19-Jun-2010 [17103x2] | Has to do with implementation of this function: http://github.com/hostilefork/Rebmu/blob/master/rebmu.r#L448 |
Instead of [REMAP-DATATYPE email! email? "em"] I'd like [REMAP-DATATYPE email! "em"], but was confounded in trying to figure out how to write a version of that which worked reliably. | |
Ladislav 20-Jun-2010 [17105x2] | just BTW, an expression like is-email-addr: get bind load "email?" bind? 'system can be expressed using a shorter form is-email-addr: get bind load "email?" 'system |
, which is, in fact, the same, as: is-email-addr: get load "email?" | |
Graham 22-Jun-2010 [17107x3] | this is something curious I just noticed. If you pass a file as a parameter to a rebol program on the dos command line it works but if you do the same in a dos batch file, it does not |
eg:. script.exe %/c/rebol/myfile.dat works from the dos command line but to get it to work in a batch file you have to do this script.exe %%/c/rebol/myfile.dat | |
I presume it's because the command processor tries to do a substitution using the % | |
Anton 23-Jun-2010 [17110] | That would be it. |
DideC 24-Jun-2010 [17111] | % is the variable begin/end tag. ie: C:\> set directory=c:\windows C:\> dir %directory% But in batch file, it's also the begin tag for a "number" variable equal to the n'th parameter of the script. %1 for first param, %2 for second... ie: C:\> type mybatch.bat dir %1 C:\> mybatch.bat c:\windows |
Graham 24-Jun-2010 [17112] | So, is there any other way to escape the % ? |
DideC 24-Jun-2010 [17113] | I though escape char was ^, so let's try "^%" |
Graham 24-Jun-2010 [17114x2] | Not in a batch file .. doesn't work |
that's the Rebol escape char | |
Fork 24-Jun-2010 [17116x2] | http://tinyurl.com/3amb3zh:) |
%% is a typical answer, since doubling the escape/meta character is usually sensible. Well, to the extent that batch files are sensible. | |
Graham 24-Jun-2010 [17118] | I guess it was a good guess then :) |
Oldes 25-Jun-2010 [17119] | >> f: func[][ print "kuk" make error! "bla"] f kuk ** User Error: bla ** Near: make error! "bla" Is there any way how to get something more useful in the "Near:" part of the user error? |
Sunanda 25-Jun-2010 [17120] | This will get you a "near f" message and an arg1 code of 404, but not an error of type 'user --- is that more useful? f: func[][ print "kuk" make error! 404] if error? bad: try [f] [probe disarm bad] |
Oldes 25-Jun-2010 [17121] | no... it isn't. the neer is again just [make error! 404] |
Sunanda 25-Jun-2010 [17122] | Sorry....my mistake. 'near is '[make error] as before but 'where is 'f (rather than none) So _slightly_ more useful? |
Oldes 25-Jun-2010 [17123] | Yes.. that's true.. but in real life I need more complex message instead of "bla" |
Sunanda 25-Jun-2010 [17124] | f: func[][ print "kuk" make error! ["complex" 9999]] f 'where gives you 'f 'near gives you a whole block -- lots of room for a complex message :) |
Oldes 25-Jun-2010 [17125x4] | it's not so easy as it does not allow to add some variables... for example: >> f: func[][ val: random 10000 make error! reduce ["complex" val]] f ** Script Error: Invalid argument: complex ** Where: f ** Near: make error! reduce ["complex" val] |
>> f: func[][ val: random 10000 err: reduce ["complex" val] make error! err] f ** Script Error: Invalid argument: complex ** Where: f ** Near: make error! err | |
I use: >> f: func[][ val: random 10000 make error! reform ["complex" val]] f ** User Error: complex 7367 ** Near: make error! reform ["complex" val] but would like to change the neer to place where the f is called | |
but maybe the user defined errors are not suitable for that | |
Maxim 25-Jun-2010 [17129x3] | you can use an object spec block to define errors, but you have to know proper codes or else the error won't build itself. |
is there a way to get access to the main script's header within code you execute using 'DO when I do %source.r and source.r defined as: print system/script/header/title I get the title of the source.r file... not the main script. | |
well after a little bit of screwing around I came up with this function: ;----------------- ;- get-application-title() ;----------------- get-application-title: func [ /local script parent ][ parent: system/script until [ script: parent parent: script/parent none? parent/header ] script/title ] | |
Ladislav 25-Jun-2010 [17132] | f: func[[catch]][print "kuk" throw make error! "bla"] f |
older newer | first last |