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

World: r3wp

[Core] Discuss core issues

Anton
25-Oct-2005
[2553]
On Windows:
>> get-modes %rebol.exe 'file-modes

== [creation-date access-date modification-date owner-write archived 
hidden system]
>> get-modes %rebol.exe 'creation-date
== 19-Aug-2003/11:21:03+10:00
Brock
25-Oct-2005
[2554]
newbies/hobbyists
Volker
25-Oct-2005
[2555]
I ask for cheatcodes immediate. There are enough doors left anyway.. 
;)
Alek_K
27-Oct-2005
[2556]
Style/functionality question: I'm writing a function to deal with 
adding to block a block with [Title Content [(Childs if exists)]].

Childs are not required - is it better to add [Title Content] (if 
no childs) or to provide empty block - [Title Content []]?
BrianH
27-Oct-2005
[2557x3]
Support both by setting a default value of an empty block in your 
code, perhaps like this:
childs: any [pick data 3 []]
Pick returns none if out of range, so any will move on to the next 
expression, your default value.
If you need to change the childs block, remember to use  make block! 
0  or  copy []  instead of  [] .
Alek_K
27-Oct-2005
[2560x3]
Yes, i know that.
My question is more "philosophical" - what is better by experience.
As for now, I think that providing empty block will be more "compact"
BrianH
27-Oct-2005
[2563]
It's better to be forgiving in your dialects - it leads to fewer 
syntax errors.
Alek_K
27-Oct-2005
[2564]
be forgiving
 - what do you mean?
BrianH
27-Oct-2005
[2565x2]
brb
From a philisophical standpoint, it is best to be somewhat forgiving 
in your evaluation of the syntax of data that is input to your function, 
but exact in the syntax of the data that is ouput from your function. 
That will make sure that the effect of errors or flexibility in the 
data is limited to the code that is doing the initial evaluation. 
This means that if you can figure out from context what a default 
value is, do so, and then your function will be more usable, particularly 
when the data may be written by hand.
Alek_K
27-Oct-2005
[2567]
Thanks Brian :)
BrianH
27-Oct-2005
[2568]
It's sort of like the stated philosophy of Unix command line utilities.
Graham
29-Oct-2005
[2569]
this should be in core

 cls: does [ print "^(1B)[J" ]
Graham
30-Oct-2005
[2570]
I am creating some variables dynamically

so, they are .. "formvar1" .. "formvarn"

how do I unset them?
Terry
30-Oct-2005
[2571]
unset[ formvar1]
Graham
30-Oct-2005
[2572]
>> var1: does [ print "hello" ]
>> var: join "var" 1
== "var1"

so, given 'var, how do I unset var1 ?
Izkata
30-Oct-2005
[2573]
>> unset to-word var
Graham
30-Oct-2005
[2574x2]
ahh...
that seems to work.
BrianH
30-Oct-2005
[2576]
While reviewing the action! functions, I noticed the path action. 
The doc comment says "Path selection.". The parameters aren't typed. 
Does anyone know what this action does, and how to use it? Or whether 
it can be called directly at all?
OneTom
30-Oct-2005
[2577x2]
what are action values anyway?
imean, where are they documented?
DideC
30-Oct-2005
[2579]
help action!
OneTom
30-Oct-2005
[2580x2]
it only  list all the action! values. hey you are just bluffing! 
:)
btw, ive seen u invited to the french translation task. im heavily 
trying to learn rebgui, so u as well can use a nice editor for the 
qtask lang file ;)
Volker
30-Oct-2005
[2582]
path seems to be a "clear find". Do not know about uses.
OneTom
30-Oct-2005
[2583]
but it keeps the length
Volker
30-Oct-2005
[2584]
it pokes an 'unset! there. mold then stops.
OneTom
30-Oct-2005
[2585x2]
yeah, i saw
and fucks it up somehow, because if i change the unset!  to something, 
the path still stays in a strange state
Volker
30-Oct-2005
[2587x2]
I could repair it with a/4: 12
maybe could be used to exclude something from mold? To stop this 
recursive things?
OneTom
30-Oct-2005
[2589]
could u show me w an example what mold are u talkin about?
BrianH
30-Oct-2005
[2590]
OneTom, actions are how type-specific operations are implemented 
in REBOL. Every datatype has a table of function pointers, one pointer 
for every action. Every one of those tables are layed out the same, 
with the function corresponding to the same index being the version 
of the same function for that specific type. Each action! has an 
index associated with it - you can see the index like this:

>> second :add
== 1


When the action! is called, REBOL checks the datatype of the first 
argument to it and then calls the function at that index into the 
datatype's table. This is the way that REBOL implements polymorphic 
native functions, single dispatch on the datatype.


But really, you don't need to know any of this. All you need to know 
is that an action! is like a native!, but with a differently named 
datatype.
Volker
30-Oct-2005
[2591]
!> a: [b 1 c 2 d 3]
== [b 1 c 2 d 3]
!> path a 'c
!> a
== [b 1 c]
!> length? a
== 6
!> a/4: 12
== 12
!> a
== [b 1 c 12 d 3]
OneTom
30-Oct-2005
[2592]
:)) it still makes me feel a lot happier knowing all these background 
info, brianh! thank you for clarifying this
Volker
30-Oct-2005
[2593x2]
Its a good idea to know about it. Seems its possible to path action! 
to protocol. at least i made a 'find in a  protocol once and got 
all the refinements.
to path -> to pass ..
BrianH
30-Oct-2005
[2595x3]
It's pretty easy to figure out when you realize that second on an 
action! returns an integer. Everything else follows from there.
At this point, I can't imagine what the path action! would be good 
for. Perhaps it is part of the object! internals?
Volker, by protocol do you mean a port type?
Volker
30-Oct-2005
[2598x3]
Cant have a use, else i had heard of it :) Practical use: it blocks 
mold. Recursive data, Code-obfuscation?
!> a: context[b: 1 c: 2]  path a 'b  ?? a
a: make object! [
    b: end
    c: 2
]
Yes.
Would be able to implement find on a port that way.
BrianH
30-Oct-2005
[2601]
I'm going to copy my path question to RT Q&A.
OneTom
30-Oct-2005
[2602]
let us know the answer! paste it here if u got any!