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

World: r3wp

[Core] Discuss core issues

Maxim
21-Sep-2010
[18352]
well...  can I not agree with the design, cause "there's a GAPING 
hole in the design"  ;-)
Ladislav
21-Sep-2010
[18353]
you guys didn't solve the "how do we use an integer as a key instead 
of an index" - you *can* use integer as a key without using it as 
an index, if you like. Nevertheless, the path-access does not work 
like that. You should either get used to it, or use a different access 
method, that is all. Anyway, you have got no right to call it a "GAPING 
hole in the path evaluation", taking into account, that it is by 
design. The fact, that your design preferences differ is irrelevant.
Maxim
21-Sep-2010
[18354x3]
no not irrelevent.  we are all users, and some of us agree that this 
is a hole in the design.
Carl isn't all knowing and he has seen the light on many user ideas 
too.
using integers is often the only way get access to huge datasets 
and being able to provide keys.
Ladislav
21-Sep-2010
[18357]
we are all users, and some of us agree that this is a hole in the 
design.
 - so what? some don't, which proves my point
Maxim
21-Sep-2010
[18358x2]
not being able to use paths to access these datasets is quite annoying 
since we can practically do all the rest.
but the fact that you don't agree doesn't make other's points irrelevant 
Lad.  :-)
Ladislav
21-Sep-2010
[18360x4]
It does in this case, your point is irrelevant, since it you are 
trying to call "a hole in the design" something, that provably *is 
the design*
Not being able to use my radio frequency tuner for TV broadcasting 
may be disliked by me, but I have no right to call such a property 
"a hole in the design" regardless how many other people would want 
to agree with me
And, your "integer problem" is easy to solve. I guess, that you are 
so experienced, that you actually *are* able to do it.
Just do not use a hammer instead of a screwdriver
Maxim
21-Sep-2010
[18364x2]
Lad, the only thing I can see from my side of the fence, is that 
you are closed to an idea... simple as that.
you don't like it so its irrelevant.  how can I even start to argue. 
 


All I can say is that I would have used it often in the past, and 
that I support Anton's idea.   


there might be other, better notations, but there should be something 
*native* in path evaluation which allows us to search for integers, 
just like we can search for other datatypes.


something like /a/:1/b  wouldn't be too bad either and it might match 
better the idea of getting the value of 1 but that doesn't work ATM.
Geomol
21-Sep-2010
[18366]
>> :1
== 0:01
>> type? :1
== time!

That's occupied.
Maxim
21-Sep-2010
[18367x2]
I know, but I've never like that :xx is a time... its totally undefined 
...  reading  :1  I don't get any sense of time. 


my guess is that its just a side-effect of how the loader sees : 
and digits .  requiring a number before :  wouldn't invalidate any 
script or dataset that I can think of.

lexicall it realy doesn't make much sense... or does it?
but again, that was just a slight spin on the idea... there are probably 
other notations we aren't thinking about.
Geomol
21-Sep-2010
[18369]
I tend to agree with that. But then we need a new datatype for :1, 
the get-integer! datatype. All such examples points me to actually 
making get-paren! and lit-paren! datatypes, but some see those as 
maybe strange. With get-paren! the path problem could maybe be solved 
as:

blk/:(1)
Maxim
21-Sep-2010
[18370]
yeah, that was the other idea I didn't post....
Oldes
21-Sep-2010
[18371]
Why you just don't use SELECT where you need to select something?
Maxim
21-Sep-2010
[18372]
but I don't see the problem with a lit integer.  how is it any strange. 
 its a label that represents one.  if you evaluate '1 you get 1. 
 


it just allows (programatic) differentiation between a value and 
a number.
Geomol
21-Sep-2010
[18373]
Oldes, becuase the path might be deep: blk/1/a/2/b
Maxim
21-Sep-2010
[18374x3]
yes Oldes, but that is not the point of the idea... I often use path 
notation to browse datasets, its VERY effective at simulating just 
about all of what xpath does, natively.
when I talk to XML-minded people and tell them that we've got paths 
embeded in the language they always *really* like the idea... and 
I understand them.
I've had to handle datasets that where 10 levels deep.   having to 
stop mid-way... use a select and then start again, breaks the whole 
idea of using paths to begin with.
Oldes
21-Sep-2010
[18377]
And it so usual in your datasets that you need integer keys?
Maxim
21-Sep-2010
[18378]
it has also forced me to use unfeasible types like issues or tags 
to simulate keys.  but then it requires a *lot* more CPU and RAM.
Geomol
21-Sep-2010
[18379]
get-paren is not without problem too, because what should this mean:

:(1 2)
Maxim
21-Sep-2010
[18380]
parens return the last part of their evaluation... the 1 here is 
just superflous
Oldes
21-Sep-2010
[18381]
anyway.. why you simply do add a wish to CC and see what Carl thinks 
about it.
Maxim
21-Sep-2010
[18382x2]
Oldes, its just strikes me as very odd that we cannot use the most 
efficient key in the book.   a single, simple, integer.  :-)
yep... anton already did.  :-)
Geomol
21-Sep-2010
[18384]
But then you assume, the paren is evaluated. get- datatypes normally 
mean: don't evaluate.
Maxim
21-Sep-2010
[18385]
the path evaluation is responsible for what it does with any type. 
 just like a parser.   for path notation is only serves the purpose 
of identifying a label vs an index (in the case of integer results 
specifically)
Geomol
21-Sep-2010
[18386]
Anton suggested: blk/'1
Maybe it's a new datatype, the lit-integer! '1
I'm not sure, what to mean about it.
Maxim
21-Sep-2010
[18387x2]
its a number... not a value.
(though its stored as a value, lets be pragmatic about it  ;-)
Oldes
21-Sep-2010
[18389]
btw... is this what you want:
>> m: make map! [2 "a" 5 "b"]
== make map! [
    2 "a"
    5 "b"
]
>> m/(2)
== "a"
>> m/(5)
== "b"
Maxim
21-Sep-2010
[18390]
It does, for the map specifically.
Andreas
21-Sep-2010
[18391x2]
and the parens around this are redundant, for maps:
>> m/2
== "a"
>> m/5
== "b"
(In R3, at least.)
BrianH
21-Sep-2010
[18393]
That is one of the better reasons to use map! values for key-value 
behavior in R3.
Geomol
22-Sep-2010
[18394x2]
I think, that solved the problem althogether. Use map! instead of 
block! for this behaviour. Makes sense to me too. block! is just 
an array, and blk/1, blk/2, ... means 1st, 2nd, ... item in the array. 
For key lookup behaviour, use map!. (Doesn't help in R2 though.)
Maybe if the map! behaviour was implemented for the hash! datatype 
in R2!?
Anton
22-Sep-2010
[18396x3]
Let me just make absolutely clear, once and for all; I did not propose 
to add any new datatypes (not lit-integer!, not get-integer! or anything 
else) to Rebol.

First, the only reason for such a new datatype would be for path 
evaluation.

Second, any new datatype with special meaning during path evaluation 
would then suffer the same problem that integer! currently has, ie. 
not being SELECTable; so this would solve a problem only to create 
an identical problem.


So what did I actually suggest? To extend the syntax of paths to 
allow a different evaluation for number values (actually to switch 
off the special treatment they currently get).
Oldes, "Why you just don't use SELECT where you need to select something?"


We can. Of course we can. However, it would be much more convenient 
to use a path in many cases.

Using SELECT:
- Requires temporary variables, breaking up the expression, or
- Requires the complexity of composing a path and evaluating it.
- Either of the above bloats out the code.
The map! behaviour looks like it would probably be good for many 
situations (and probably could have been used nicely in DideC's situation, 
were he not using R2).

However, it would not be convenient to create maps instead of blocks 
in other situations.

Instead of "[...]" you would need at least "make map! [...]", which 
means more code, something I would like to avoid.
Oldes
22-Sep-2010
[18399x2]
You can always use TO-MAP:)
btw.. in many case using temporaly variables is not so bad and may 
have better results than multiple deep path queries.
Pekr
22-Sep-2010
[18401]
going via the variable disturbes your smooth flow of thoughts :-) 
we want as much of function chaining, as possible :-)