World: r3wp
[!REBOL3-OLD1]
older newer | first last |
Maxim 3-Apr-2009 [12585x2] | strange although symmetric. |
wrt "If you read the source you might notice that if you don't specify /unbound, the code has to *explicitly* bind the loaded code." didn't you mean IF you specify /unbound ? | |
BrianH 3-Apr-2009 [12587] | What I don't like is the 'val variable - I'm goinng to rename it to 'hdr next version. |
Anton 3-Apr-2009 [12588] | That would be a good change. |
Maxim 3-Apr-2009 [12589] | yeah... I guess its val for historic reasons. |
Anton 3-Apr-2009 [12590] | Uh oh - I've just noticed TMP is being used for different purposes. It's meaning is different at different parts of the function, making it harder to understand and reason about the function. |
Maxim 3-Apr-2009 [12591x2] | brian, still a bit puzzled by you last /unbound comment |
possibly just optimisation of recycling words, not to clutter up the number of locals for nothing? | |
Anton 3-Apr-2009 [12593x3] | Yes, but cluttering up our heads with a muddle of confusion instead. |
I think it's inexcusable in this context. | |
(That's a bit of a strong word. I should say the function should not be considered complete until such variable names are removed.) | |
BrianH 3-Apr-2009 [12596x2] | No, to-block and transcode make unbound words. If you *don't* specify LOAD/unbound, LOAD won't bind the words, which it actually has to do explicitly with that BIND/new statement. |
(sorry, went offline for a moment) | |
Maxim 3-Apr-2009 [12598] | I do word recycling myself, but only in repeatedly used functions... but load being used just a few times per script, such optimisations seem a bit excessive, but then if that code was taken from Carl, he does pretty excessive optimisations all the time. |
BrianH 3-Apr-2009 [12599x3] | TMP is just that, a temporary variable. It has no special meaning that isn't mentioned in comments. |
The code wasn't taken from Carl, I wrote it from scratch. I write LOAD. | |
Carl's code was less optimal. | |
Maxim 3-Apr-2009 [12602] | hehe carl's style is growing on you ;-D |
BrianH 3-Apr-2009 [12603] | I've been the main writer of the non-GUI mezzanine changes for thhe last year. My code tends to be more strict than Carl's :) |
Anton 3-Apr-2009 [12604] | I think VAL has a right to exist (with that name), because just after it is first set, you don't know whether it's a header block or not. You have to check. At the moment you have determined that its value is a script header, then you can do: hdr: val which does mean you now have two locals, HDR and VAL, but I don't know any other way of preserving the clear and unambiguous meaning of a variable. |
Maxim 3-Apr-2009 [12605] | actually, most rebolers tend to grow the same habits in time :-) |
BrianH 3-Apr-2009 [12606] | If you think the code is bulletproof now, wait until after I do the ASSERT review of the entire codebase :) |
Anton 3-Apr-2009 [12607] | BrianH, I'm very glad you put those comments around the use of the TMP variable. But keep in mind, when quickly checking the source of a function in the console, the comments are lost. Not very convenient for quickly understanding how something works and returning to your workflow. |
Maxim 3-Apr-2009 [12608] | I was going to ask what assert is about? |
BrianH 3-Apr-2009 [12609x2] | Well, this is one of those functions that *has* to be as bulletproof and efficient as possible. Even Carl defers to my judgement on LOAD. I try to make it easy to read, but there's no point about worrying about lost comments when the source is a CHAT 26 LF away. |
ASSERT: http://www.rebol.net/r3blogs/0178.html | |
Maxim 3-Apr-2009 [12611] | thx |
Anton 3-Apr-2009 [12612] | You appear to be doing a very good job of it, overall, don't get me wrong. I wish you'd see my point of view with respect to other (future) users who will view the code in the console, not in some source file locatable somewhere if you're lucky and the RebDev chat server is still running. |
BrianH 3-Apr-2009 [12613x2] | DevBase is where the source will be, with full history. It's one of the primary features of R3. It's not going away. |
I mean, we'll probably have source packages and we will have DocBase and the manual, but DevBase is where the source is. | |
Maxim 3-Apr-2009 [12615] | what does assert return when all is ok? true? |
BrianH 3-Apr-2009 [12616] | Yes. If it's not OK it throws an error. After an assert you can count on the conditions being true. |
Maxim 3-Apr-2009 [12617x2] | is there a none returning version of assert... a bit like first vs pick ? |
all intersting stuff btw. | |
BrianH 3-Apr-2009 [12619x2] | Yeah. ALL. |
And FIRST returns none in R3. We're trying to make the errors more useful and meaningful in R3. | |
Maxim 3-Apr-2009 [12621] | that would mean less errors? but better ones? |
BrianH 3-Apr-2009 [12622] | Yup :) |
Maxim 3-Apr-2009 [12623x3] | cool. |
does ALL also support the /type refinement in R3 ? | |
now you see... I'm all fired up on R3 and I've stoped working for the past hour.... ;-) glass is now an hour behind schedule ;-) | |
BrianH 3-Apr-2009 [12626x2] | Nope, but SWITCH TYPE?/word does (effectively). |
Or FIND typeset! value. | |
Maxim 3-Apr-2009 [12628x2] | my first R3 func .... valid?: func [spec][attempt [assert spec]] ; -) |
so I can assert within any/all blocks ;-) | |
BrianH 3-Apr-2009 [12630] | valid?: func [spec /type][attempt [apply :assert [:spec type]]] |
Maxim 3-Apr-2009 [12631] | yess apply that is a great addition to R3 8-D |
BrianH 3-Apr-2009 [12632] | Already backported to R2-Forward. |
Maxim 3-Apr-2009 [12633] | must be a bit slow though... is it? |
BrianH 3-Apr-2009 [12634] | R2-Forward is also in DevBase (and has *lots* of comments). |
older newer | first last |