World: r3wp
[Rebol School] Rebol School
older newer | first last |
Ladislav 31-May-2011 [3478x3] | I guess, it's more precise to say, that the decimal! datatype has 15.95 decimal digits of precision. - the most precise is to say, that it has (usually) 53 binary digits of precision. That can be "transformed" to 15.95, but such a "transformation" is quite uniformative, since it ignores some important facts |
Fact #1: the representation is binary, and it cannot represent exactly even the numbers representable using just one decimal digit Fact#2: 16-digit decimal numbers cannot be used to represent "exactly enough" the IEEE754 binary numbers | |
(to not confuse the reader, I should have used "precisely enough" instead of "exactly enough" in the above fact#2 statement) | |
Janko 2-Jul-2011 [3481x2] | why is , not valid word? |
>> type? '. == word! >> type? ', ** Syntax Error: Invalid word -- ', ** Near: (line 1) type? ', | |
Geomol 2-Jul-2011 [3483] | Assumably because the opinion was/is, that commas make programs less readable. I see no other reason. |
Janko 2-Jul-2011 [3484x2] | I see it absolutely cruicial that there aren't commas between elements [ 1 2 3 ] NOT [ 1, 2, 3 ].. but this has nothing to do why , couldn't be a valid word of a dialect for example if . ` (for example) are IMHO |
(I suspect it's used somewhere, but I don't see it .. like % or $ is not a valid word since they are part of file / money format ( not that parser couldn't be made a little smarter and still allow it)) | |
Oldes 2-Jul-2011 [3486] | Good question... I was asking as well long time ago http://www.rebol.org/ml-display-message.r?m=rmlDRXJ |
BrianH 2-Jul-2011 [3487] | Geomol, you are the winner! That is the official reason. Plus, ,0 is the same as 0.0 since , can be used as a decimal separator. |
Janko 2-Jul-2011 [3488x4] | so any program that has , anywhere is ugly so we ban them.. it's no use in complaining, but that doesn't make sense to me. |
now my dialect that consumes sql has dots instead of commas [ select user.id . user.* from user where id = #myid and name = #name ] .. I will surviwe but I will hardly impress any geeks to rebol with it as I otherwise could :) | |
Oldes, I'm on linux where I can't copy poaste that url from altme or click it (I don't know why linux doesn't fix dual copy paste and istead focuses of various fancy stuff) | |
So I will reply later when I can | |
Geomol 3-Jul-2011 [3492x2] | If comma is allowed as word, decision has to be made, what to do with things like ,0 as Brian point out. Either anything starting with a comma should be words (easy to implement, but might give unpredicted result to users trying to writing decimals starting with a comma) or a special rule should be made, so it's a decimal, if the comma is only followed by digits, else it's a word (harder to implement). |
You also need to handle things like: ,000'000e+4 which is simple 0.0 today. | |
Henrik 3-Jul-2011 [3494] | To me, not having comma is a problem in that certain types of data become much harder to load. |
Endo 3-Jul-2011 [3495x3] | This is also strange: b: to-block ";" length? b == 0 |
even: b: to-block ";;;;;;;" | |
I think these issues are related to parse, as coma and semicolon are default separater for parse. | |
Henrik 3-Jul-2011 [3498] | actually not strange, since to-block converts the string into REBOL data, so it's interpreted as an inline comment. I think the behavior is correct. |
Endo 3-Jul-2011 [3499] | I see, that's correct. I missed that semicolon is for commenting. |
Henrik 3-Jul-2011 [3500] | TO-BLOCK can be seen as a cheap version of LOAD, AFAIK. |
BrianH 3-Jul-2011 [3501] | Much cheaper on R3 than R2 - LOAD does a lot of work. Note that TO-BLOCK doesn't bind any words in the resulting block, which can come in handy sometimes. |
Endo 3-Jul-2011 [3502] | thanks, I would I ask what is the difference :) |
Gregg 3-Jul-2011 [3503] | TO BLOCK! is much safer on untrusted data as well. |
Endo 3-Jul-2011 [3504] | what is risk if I use load? |
Gregg 3-Jul-2011 [3505x2] | The comma being disallowed as a word does mean you can't use it literally i true dialects, but that doesn't prevent you from writing a DSL and using string parsing. There have to be lines drawn somewhere. |
LOAD used to evaluate headers aggressively, though I don't think it does any more under R2. I'm not sure about R3, but I imagine Brian has made sure that's safe. | |
Izkata 4-Jul-2011 [3507] | Janko: If you right-click the URL, it says "Copied to clipboard" - it means the X clipboard, which you paste from in Linux by using middle-click |
Janko 4-Jul-2011 [3508x7] | Izkata: wow .. it works! :) |
Oldes: I read the discussion on mailing list. Obviously I agree with you (in fact our reasoning is like copied:) | |
Gabriele interestingly subverted your reasoning by "you can't expect REBOL to be able to parse into REBOL values any syntax", but that is not the reasoning here :) . Reasoning is simple why rebol isn't more consistent and | |
(pressed the submit by accident).. reasoning is: | |
If consistency good? | |
if . is word why isn't ,? you mentioned that it's because: >> ,012 == 0.012 but that fails since this also works :) >> .012 == 0.012 | |
but I know there are more prominent things to change/fix (if any will get fixed at all) that I don't realistically expect anything changed about this in near future (but that sql dialect would be much cooler if it werent for , exception) | |
Gabriele 5-Jul-2011 [3515x3] | index.html is a useful word, index,html is not. |
there has to be a place where you draw the line... will you ask for $ next? what about #? What about ' ? or : ? or even ; ? | |
some characters are reserved for a reason. if you're parsing another language, use string parsing. LOAD is supposed to parse REBOL, not other languages. | |
Geomol 5-Jul-2011 [3518] | ' can be used in words like: >> can't: 42 == 42 >> can't == 42 Some would argue, comma is kinda the same. |
Endo 5-Jul-2011 [3519x2] | there is a behaviour difference for LAST function on blocks and lists: >> b: next next [1 2] >> last b ** Script Error: Out of range or past end ;which is ok >> a: next next make list! [1 2] >> last a == 2 But it is not same for FIRST >> first a ;(or first b) ** Script Error: Out of range or past end ;same for both. |
>> a == make list! [] >> last? a == false | |
Maxim 5-Jul-2011 [3521] | I'd say its a bug with the list! datatype. |
Endo 5-Jul-2011 [3522x3] | I guess so, because reverse is changing the internal position also: >> a: make list! [1 2 3] == make list! [1 2 3] >> reverse a == make list! [3 2 1] >> a == make list! [1] |
it goes to last item in the list. But it doesn't work like that for block! values. >> b: make block! [1 2 3] == [1 2 3] >> reverse b == [3 2 1] >> b == [3 2 1] | |
There is a bug report on Rambo for reverse on list! http://www.rebol.net/cgi-bin/rambo.r?id=4420& | |
Gabriele 6-Jul-2011 [3525x3] | Geomol, right, so, should we also allow # inside a word? Why not allow even [ then? You have to draw a line somewhere, both to simplify the parser, and so that the language is readable. The , has a special meaning in basically every language, so it's hard to know what the consequences of allowing , would be, even assuming the parser is not affected by it. |
ie. imagine having: f (a,b + c,d) I suspect that'd confuse the hell out of most people. | |
You could trivially change the parser in Topaz to allow [ and ] inside words, and then write something like: a[b c]d but, is that a good thing? So, what's the actual purpose of allowing a,b to be a word? So far, the only purpose has been "to parse other languages as if they were REBOL". That's not a good purpose, because they are *not* REBOL. If you need to parse other syntax, you need string parsing. block parsing is for REBOL dialects. The only sensible reason I can imagine for , to be a word would be to use it as an operator so that: a , b means also a b but that has the same readability problems of using . as a "end of command marker" in dialects. a nice idea in abstract, but terrible in practice. | |
older newer | first last |