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

World: r3wp

[Core] Discuss core issues

BrianH
25-Apr-2006
[4118x3]
What I was talking about earlier was the allocation quanta. Blocks 
are allocated with the assumption that you will want to insert stuff 
into them without having to reallocate them every time. So by that 
powers of two to multiples of 128, when you want a block length 10, 
you get 16. When you want 129, you get 256, and so on. On that note, 
when you want 1000000, you would get 1000064.
A list may be twice as big, but if you want memory predictability 
you can't beat it because the allocation quanta is 1 node and the 
insert/delete is O(1). Indexing and length calculations are O(n) 
though.
Later...
Maxim
25-Apr-2006
[4121]
ciao, thanks for all that info  :-)
Henrik
26-Apr-2006
[4122]
wouldn't it make sense for SKIP to support hex values? I'm trying 
to locate a specific position in a binary and it's tedious having 
to convert to number! every time.
Volker
26-Apr-2006
[4123]
what do you convert to number?
Gregg
26-Apr-2006
[4124]
What is a hex value in REBOL?
Henrik
26-Apr-2006
[4125]
volker, a specific location in the binary taken from a hex editor
Volker
26-Apr-2006
[4126x2]
but that conversion could be put in a little function by yourself?
i think non-system-coders rarely use hex.
Maxim
26-Apr-2006
[4128]
skip can be redefined to something which supports hex numbers...
Henrik
26-Apr-2006
[4129]
I just think it's too obvious and useful to leave out
Gregg
26-Apr-2006
[4130]
But what is the proper representation of a hex value in REBOL? An 
issue? An ENBASEd string?
Henrik
26-Apr-2006
[4131]
it's an issue
Volker
26-Apr-2006
[4132]
why not write a converter and then
  skip bin &h #c4d9
Gregg
26-Apr-2006
[4133]
Ah, but an issue is really a string, not a number. The TO-HEX function 
makes it look like this is the recommended approach (it's what I 
would say, too), but I think it's a type mismatch (unfortunately).
Henrik
26-Apr-2006
[4134]
I see
Gregg
26-Apr-2006
[4135x3]
That is, I don't think standard functions should take issue! params 
for hex values unless RT says, officially, that it's how you do hex 
values in REBOL.
Is hex notation something we should propose for R3? I'd bet money 
Carl thought about it long and hard in the original design, and may 
even have left some lexical wiggle-room to add it later.
propose = request.
Henrik
26-Apr-2006
[4138]
well, I can understand it if there is no official way to represent 
hex values. I think it should be proposed for R3
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
[4167]
i.e. why would a refinement be better than using PARSEs ANY keyword?