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

World: r3wp

[Core] Discuss core issues

Volker
26-Apr-2006
[4139x2]
Its nearly never needed, but if it is needed, its very usefull.
hex-editor or ascii or decoding this unix-rights-numbers or such.
Gregg
26-Apr-2006
[4141]
REBOL is very high level, and you tend to use hex notation more in 
low level scenarios, but it's *so* handy to have it there when you 
need it.
Maxim
26-Apr-2006
[4142]
yess the kind of thing you need when you are doing projects and the 
specs are not your own.  on the other hand, HTTP 1.1 uses hex values 
for chunk sizes (stupid design if there is one)... so they are still 
used.
Gregg
26-Apr-2006
[4143x3]
Here's what I use:

    hex: func [
        {Returns the base-10 value of a hexadecimal number.}
        value [integer! string! issue!] "A hexadecimal number"
    ][

        ; Convert to an issue first, so integers can also be translated.
        to integer! to issue! value
    ]
When I first started in REBOL, I also aliased it as &H (as a func 
name), since that's the hex notation prefix in BASIC and can be used 
as a func name, unlike "0x"
It is a little extra work to use a func to convert values, but not 
awful. If you need to use it heavily in a particular app, I'd consider 
using a dialect.
Henrik
26-Apr-2006
[4146]
binary tools powerpack then?
Gregg
26-Apr-2006
[4147]
You bet. Outline the domain and we can cook up a killer dialect.
Maxim
26-Apr-2006
[4148]
the problem I have with dialects is they are not extensible
Henrik
26-Apr-2006
[4149]
it would be worthy of its own group, wouldn't it?
Gregg
26-Apr-2006
[4150]
I think so Henrik, for better focus.
Henrik
26-Apr-2006
[4151]
I'll create it now
Maxim
26-Apr-2006
[4152]
I mean without rewriting the original dialect parser itself.
Gregg
26-Apr-2006
[4153]
Who says Max?
Volker
26-Apr-2006
[4154]
OT: regarding dialects: could 'any be an option in parse? i often 
have
 parse blk [ any[  .. ] ]
would like 
  parse/any blk [ .. ]
Maxim
26-Apr-2006
[4155x2]
when I tried to plug within VID... man it was awfull.
I ended having to piggy back on top of VID.
Gregg
26-Apr-2006
[4157]
The Logo interpreter I did (early in REBOL for me) allowed user defined 
functions; basically it just added things to the list of parse rules 
it knew about, naive, but semi-functional. :-)
Volker
26-Apr-2006
[4158]
it predates the block-parser, and that shows.
Maxim
26-Apr-2006
[4159]
and that means actually calling the VID parser many many times...
Volker
26-Apr-2006
[4160]
rebgui looks much cleaner IMHO.
Gregg
26-Apr-2006
[4161]
Dialects have to be planned for extensibility, just like languages.
Maxim
26-Apr-2006
[4162]
gregg, exactly... you have to dialect your dialect's  dialecting 
ability  ;-)
Gregg
26-Apr-2006
[4163]
ANY - Not sure what you mean Volker.
Maxim
26-Apr-2006
[4164]
but that's usually harder than the dialect itself, and there are 
no ways to ensure that this door, won't corrupt your dialect itself..
Henrik
26-Apr-2006
[4165]
group created, lets move binary stuff to there
Volker
26-Apr-2006
[4166]
i need two nested blocks. nearly everytime i use 'parse.
Gregg
26-Apr-2006
[4167x3]
i.e. why would a refinement be better than using PARSEs ANY keyword?
Ahhhh.
Would it always return TRUE if /any is used then?
Maxim
26-Apr-2006
[4170]
I will try to re-introduce the previous block parsing engine I had 
built for glass into the newer code.
Volker
26-Apr-2006
[4171]
And that are often 3-liner, which are then 5-liner
parse/any files[
  file!(..) | url! (..)
]
Maxim
26-Apr-2006
[4172]
that dialect (not parse based) could easily implement OOP style polymorphism 
within the dialect!
Volker
26-Apr-2006
[4173]
No, only 'true if the whole rule matches.
Gregg
26-Apr-2006
[4174]
I think that might be confusing, because ANY in a parse rule implies 
optionality.
Volker
26-Apr-2006
[4175x2]
although an error would be nice too, if it does not
  parse/error blk [..]

would throw an error on fail. maybe with hints about the position.
In my use 'any means loop
Gregg
26-Apr-2006
[4177]
How about just using a PARSE-ANY wrapper mezz of your own?
Volker
26-Apr-2006
[4178x2]
Ugly. parse/any looks nicer. And its a bit slower? But does the job.
and its an extra definition in every short script (i never use %user.r 
for libs..)
Gregg
26-Apr-2006
[4180]
Well, post it as a wish then. I haven't needed it, and I'm concerned 
that the dual meaning of ANY in the context of PARSE might be confusing, 
but Carl has the final say.
Volker
26-Apr-2006
[4181]
must not be 'any, its just what is now used inside the dialect. maybe 
parse/many ?
Jerry
27-Apr-2006
[4182]
Most scripting languages (like Ruby) and even some programming languages 
(like Java) support the string-concatenation operator "+".

>> "a" + "b" 
== "ab"


I know that we can use the JOIN function, but a + operator for string 
would be nice too. Why doesn't REBOL do so?
Anton
28-Apr-2006
[4183]
>> "a" + 2 + "b"
** Script Error: Cannot use add on string! value
** Near: "a" + 2 + "b"

>> rejoin ["a" 2 "b"]
== "a2b"

What could be more elegant ?
[unknown: 9]
28-Apr-2006
[4184]
:) (and reads well to).
Anton
28-Apr-2006
[4185]
Yes, I find all those interspersed concatenation operators tiresome 
and ugly.
Terry
28-Apr-2006
[4186]
'rejoin' sounds like it was already joined once
Anton
28-Apr-2006
[4187]
uhuh.
eFishAnt
28-Apr-2006
[4188]
If I knew nothing if programming languages, I would think "a" + "b" 
= "c"   ;-)