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

World: r3wp

[Core] Discuss core issues

ChristianE
12-May-2011
[1394]
That shouldn't be a problem, Max, I don't think too many people abuse 
implementation specific hacks like this one in code other than zen 
examples ... ;-)
Sunanda
13-May-2011
[1395]
Long discussion of R3/local here:
    http://www.rebol.net/cgi-bin/r3blog.r?view=0341
Geomol
13-May-2011
[1396]
Tonight's Moment of REBOL Zen:

>> skip [a b c] to integer! true
== [b c]
>> skip [a b c] true
== [a b c]
BrianH
13-May-2011
[1397x2]
Yup. The order of logic values as considered by SKIP, PICK and POKE 
is true then false. This was done to make PICK compatible with EITHER.
Carl uses PICK instead of EITHER a lot. He also marvels that this 
trick isn't used more often, especially since he added logic indexing 
specifically for that purpose :)
Geomol
13-May-2011
[1399]
Interesting explanation! Gives us even more Zen to think about:

>> pick [a b] true 
== a
>> pick [a b] to integer! true
== a
>> pick [a b] false           
== b
>> pick [a b] to integer! false
== none
Maxim
13-May-2011
[1400]
well, difference in types is expected, its the point of having dynamic 
typing.  I don't think its a required feature for type casting to 
result in symmetric uses of other functions.    I expect to-from 
one type to another to be as symmetric as possible, but not what 
they mean in another context of usage.
BrianH
13-May-2011
[1401]
Yup, because PICK, POKE, AT, INDEX? and /1 work with indexes, while 
SKIP works with offsets.
Henrik
13-May-2011
[1402]
I would like to use the PICK option more, if also NONE was supported 
as the first item.
BrianH
13-May-2011
[1403x2]
But that would make PICK data none the same as PICK data true, not 
PICK data false.
I would really like it if TRUE? was native. There's too much code 
that needs PICK reversed-data NOT condition, which would be better 
expressed as PICK data TRUE? condition.
Henrik
13-May-2011
[1405]
perhaps there should be a three-state PICK instead.
BrianH
13-May-2011
[1406x2]
0 = none, 1 = true, 2 = false?
Or -1, 0, 1 if you are thinking in terms of offsets instead of indexes.
Henrik
13-May-2011
[1408]
that depends if both the concept of three states and index direction 
change can be merged into one function and if that makes sense.
BrianH
13-May-2011
[1409x5]
I like that PICK is stopping point for none propagation. PICK data 
none should trigger an error, because otherwise you couldn't tell 
the difference between that and PICK [#[none]] 1.
is -> is a
We keep adding more points of none propagation, and every time we 
add one it makes more errors propagate further away from their point 
of origin. This makes it harder to figure out which code caused the 
error where none wasn't screened for or checked for, making it that 
much more difficult to debug.
We don't want REBOL code to be as difficult to debug as SQL.
Although PICK does propagate none indexes for datatypes where PICK 
acts the same as SELECT, such as map! or object!.
Geomol
14-May-2011
[1414]
Tonight's Moment of REBOL Zen:

Literal and Get Arguments in R2

see: http://www.rebol.com/docs/core23/rebolcore-9.html#section-3.2

These functions use Literal Arguments:


 ++ -- ? ?? cd default deflag-face first+ flag-face flag-face? for 
 forall foreach forskip help l ls map-each remove-each repeat secure 
 set-font set-para source

This function uses Get Argument:

	quote

It could be questioned, why functions like

	get set unset in catch throw checksum


, which all have arguments named WORD, don't use Literal Arguments?
BrianH
14-May-2011
[1415x3]
Lit-word arguments are for functions that treat words as keywords 
or part of the syntax, or for interactive command line functions 
that are supposed to act like shell funcs. If you use lit-word arguments, 
you can't easily generate the value passed using an expression, especially 
in R2 - in R3, those expressions can be put in parens, as is emulated 
in the R2 mezzanine backports of R3 functions that take lit-word 
arguments. For instance, if you made GET take a lit-word argument, 
GET IN wouldn't work.
The only exception to the above is ++ and --, which take lit-word 
arguments because their primary use is with a literal word value, 
so taking a lit-word argument gets rid of a ' in the most common 
case. And since ++ and -- started in R3 and has its behavior explicitly 
emulated in R2, you can put word-generating expressions in parens 
for the less common case.
FIRST+ is part of the same exception as ++ and --.
GrahamC
14-May-2011
[1418]
Does it make sense to have a timestamp datatype as distinct from 
a date type
BrianH
14-May-2011
[1419]
Breakdown by reason:

- The word is pseudo-syntax for loop vars: FOR FORALL FOREACH FORSKIP 
MAP-EACH REMOVE-EACH REPEAT

- The function is pseudo-syntax for modifying operations on literal 
words as variables: ++ -- DEFAULT FIRST+

- Keyword arguments that aren't generally in expressions: DEFLAG-FACE 
FLAG-FACE FLAG-FACE? SECURE SET-FONT SET-PARA
- Interactive shell functions: CD LS ? ?? HELP SOURCE
GrahamC
14-May-2011
[1420x2]
>> to date! now
== 15-May-2011/10:41:51+12:00
>> to date! "15-May-2011"
== 15-May-2011
to date! creates two different types
BrianH
14-May-2011
[1422]
A timestamp more precise than NOW/precise?
GrahamC
14-May-2011
[1423x5]
No, to date! creates either a date only , or a timestamp at present
it's inconsistent
it should create a date at 0:00 and GMT
if those are not provided
A source for errors ....
BrianH
14-May-2011
[1428]
The date! type is a datetime type with an optional time portion. 
We can get rid of the time portion already. What do you want that 
we don't have already?
GrahamC
14-May-2011
[1429]
to date! should create a timezone and hour by default
BrianH
14-May-2011
[1430x3]
But that doesn't work when you don't want a time and date.
>> d: now/date
== 14-May-2011
>> d: now d/time: none d
== 14-May-2011
When you requested a timestamp type, I thought you were requesting 
a timestamp type, not a datetime type.
GrahamC
14-May-2011
[1433]
in databases .. date and timestamp are different
BrianH
14-May-2011
[1434]
In some SQL implementations, date, time and datetime are different. 
And then timestamp is different from all of those.
GrahamC
14-May-2011
[1435]
maybe just need an explicit to-datetime
BrianH
14-May-2011
[1436]
A few SQL implementations call the datetime type "timestamp" for 
some cunfusing reason. It's best to keep the concepts distinct.
GrahamC
14-May-2011
[1437]
at present 'to-date gives you either a date, or a datetime depending 
on the input.  that is inconsistent
BrianH
14-May-2011
[1438]
A TO-DATETIME function would be great. GMT by default, or local time 
like the rest of REBOL?
GrahamC
14-May-2011
[1439]
localtime would be consistent
BrianH
14-May-2011
[1440]
In R3, GMT seems to be the default time zone. Interesting.
GrahamC
14-May-2011
[1441x3]
For many webservices I prefer to work with GMT
For me the issue is that when dealing with dates, I want to get only 
the date, but it it's a date with no time portion, then date/date 
gives you an error.
So, I have to check to see what it is first.