by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 20:19
    hiiamboris commented #4604
  • 20:18

    dockimbel on master

    FEAT: failure on ARM tests will… (compare)

  • 20:18
    hiiamboris labeled #4604
  • 20:18
    hiiamboris labeled #4604
  • 20:17
    hiiamboris commented #4604
  • 19:32
    hiiamboris commented #4149
  • 19:22
    9214 commented #4149
  • 19:11
    9214 edited #4608
  • 18:37

    dockimbel on master

    FIX: avoids using R/S compiler … (compare)

  • 17:37

    dockimbel on master

    FIX: [ARM] bit-shifting operato… (compare)

  • 17:33
    9214 commented #4608
  • 17:29
    9214 synchronize #4610
  • 17:25
    Travis red/red#4610 broken (5080)
  • 17:13
    9214 edited #4608
  • 17:07
    9214 synchronize #4608
  • 17:05
    9214 opened #4610
  • 16:35
    theSherwood commented #4606
  • 16:22
    9214 commented #4165
  • 16:19
    hiiamboris labeled #4609
  • 16:17
    9214 commented #4606
Vladimir Vasilyev
@9214
I mean, we can always squeeze an extra 4-byte value in the payload and get new datatype, but it doesn't seems like a priority to me, as we don't have any related use-cases. Not to mention the amount of design musings over lexical form that it requires.
Vladimir Vasilyev
@9214
How frequently whose coming from Rebol actually wrote float-based pair! as a literal value, instead of encountering it as an intermediate computation result? With images we reason in terms of x and y amount of pixels (discrete values, integers), and rarely think of subpixel position - rather, it's almost always a result of some precise geometric computation, hidden behind graphical facade.
Vladimir Vasilyev
@9214
i.e., 1.23x45.6 looks a bit quirky if you see it, but I can live with that, because I rarely will type it by hand.
Qingtian
@qtxie

i.e., 1.23x45.6 looks a bit quirky if you see it, but I can live with that, because I rarely will type it by hand.

I'm also OK with this format.

Qingtian
@qtxie
One problem of the float32-pair is in some old code we don't always use the pair/x and pair/y as number. We use it a flag sometimes. For example, In a text editor, we may use pair/x to store the line number, usepair/y as bitset flag to store some information. In this case, we cannot use float32. But it is kind of hacking code, I think we should just 2 integers. Or use vector! if we need to record every lines in the text editor.
Gregg Irwin
@greggirwin
:point_up: September 25, 2019 5:44 AM See what happens when you hack things @qtxie? ;^)
Qingtian
@qtxie
😅
Nenad Rakocevic
@dockimbel
FYI, the refactor-lexer branch was dropped. The most useful changes from that branch were ported to master. That branch has been replaced with the fast-lexer branch now, re-implementing the Red run-time lexer in R/S.
bitbegin
@bitbegin
@dockimbel the new lexer can parse all codes, and give all errors? Also, if it return the line/column, will be very useful.
Petr Krenzelok
@pekr
Question of an uneducated - Lexer parses Red source code, during the load, or even interpretation? By rewriting lexer in R/S, will it "just" load code faster or will generally interpreter be faster?
hiiamboris
@hiiamboris
Just load. Unless you are a fan of do load "my-code" patterns :)
Still, it's a very welcome change, as sometimes you load data. After 10MBs it's unbearably slow.
And as @bitbegin notes, preserving the info about the origins (line/column) of each word would be a tremendous help in debugging. Is this planned?
Nenad Rakocevic
@dockimbel
@hiiamboris @bitbegin It's a feature I want to add since a long time, but we still haven't figure out how to do the reverse mapping between a given value and its line/column info for debugging purpose. One way would be to extend the cell! size to fit such extra info. Though, we can return that info on syntax errors, that case is trivial.
hiiamboris
@hiiamboris
Perhaps one way is to change "index in symbol table" part of a word into a pointer to a structure with that data + the actual index?
Nenad Rakocevic
@dockimbel
@hiiamboris We need a reverse-mapping to line/column (and even filename) for any value, not just words.
Maciej Łoziński
@loziniak
My thoughts on floats in pair!
  1. Every 2D point could be considered also a 3D point, also conversion between float and int could be seamless:
    >> 1x1
    == 1.0x1.0x0.0
  2. My wish - could we make possible using parens like in path!?
    >> 1x(pow 3 2)
    == 1.0x9.0x0.0
  3. In special cases (discrete image pixels, editor line hacking) we can always use vector! of integer!s.
Gregg Irwin
@greggirwin
@loziniak 2) is a significant change, which opens the question for other segmented/multi-part values, like tuples. If you could mock up some more examples using that syntax, for use cases you imagine, we can more easily weigh things. It may be that we try an as-coord helper to start, and see if paren notation still has enough value.
Dave Andersen
@dander
image.png
More of a side-note, since not everyone would have them, but with a font that has ligatures, the x-delimited ones do look a bit nicer (this is Fira Code)
Gabriele Santilli
@giesse
@loziniak 1x(something) would have to be a new block-like type. So, even though those things look like great ideas, in practice they are not.
GaryMiller
@GaryMiller

Will Fast Lexer be in tomorrows available download?
Windows red-25sep19-f753e25c.exe 1.2 MB

Will be interested to try. My Lex is running about 9 seconds now when loading into Interpreter. ~62,000 lines of Red Code

Gregg Irwin
@greggirwin
No release date announced on fast lexer.
You will be a great test case though. :^)
Maciej Łoziński
@loziniak

@greggirwin @giesse this proposed paren notation for me is natural consequence of having similar mechanism in defining path!s, which is very convenient for me:

>> a: [b [c 123]]
== [b [c 123]]
>> get to path! reduce ['a (to-word "b") 'c]
== 123
>> a/(to-word "b")/c
== 123

So, for me 1x(pow 3 2) is more easy to read/understand and shorter than as-coord 1 pow 3 2. At first glance you see that this expression is a coord!.

Gregg Irwin
@greggirwin

@loziniak I'm used to parens in paths from many years of Reboling, though I don't use them often. However, they are still considered an experimental feature in Red, as we are not sure they are worth keeping.

To make sure I understand your example, you have code with 2 known values and variable key between them, like accessing a keyed record's field. Here's a more efficient way to do that, which seems clearer to me:

>> a: [b [c 123]]
== [b [c 123]]
>> k: to word! "b"
== b
>> a/:k/c
== 123

Does the path approach give you some other benefit that I don't see at a glance?

Gregg Irwin
@greggirwin
Pairs today are completely literal in their syntactic form. There is no evaluation whatsoever, which has pros and cons, and is simply a design choice. Because of the separator used (x), which is not "special" like /, it opens up a lot more questions and potential ambiguity. Paths are specifically meant for indirect access, and have to start with a word. Do pairs in your design have to start with a literal number, or is (pow 3 2)x(pow 2 3) valid as well? Because that's no longer Red compatible as a syntactic form. If that's not valid in your design, you can only evaluate the y axis, which seems much less useful and general.
Vladimir Vasilyev
@9214
Besides
>> x: make op! :as-pair
== make op! [["Combine X and Y values into a pair" 
    x [integer! f...
>> (power 3 2)x(2 ** 3)
== 9x8
Maciej Łoziński
@loziniak
@greggirwin in your example, k is not a very meaningful name for a variable. I find it clearer to use expression to word! "b" in-place. I did not think about using get-words though, because parens were first thing I tried and it worked, so I searched no more.
hiiamboris
@hiiamboris
@9214 clever! :+1:
Maciej Łoziński
@loziniak
@9214 try to do that with hypothetic coord! :-)
@greggirwin good point about syntax incompatibility of having x part of pair! defined by paren!. That kindda invalidates my idea.
Vladimir Vasilyev
@9214
@loziniak and how can I try to do that if it's hypothetical? Thought experiment?
Maciej Łoziński
@loziniak
Exactly. Just assume it's real. Brillant hack nevertheless.
Gregg Irwin
@greggirwin

:point_up: September 27, 2019 11:16 AM @9214, you're going to Hell for that. ;^) Lacking the power to send you there, I will have to concede that it's an AWFULly cool idea for a dialect.

@loziniak forgive me for not trying to come up with a more meaningful name in a short chat example. ;^)

get-field-c-from-var-a-for-rec: func [
    key [string!]
][
    key: to word! key
    a/:key/c
]
a: [b [c 123]]
get-field-c-from-var-a-for-rec "b"
Shoot, should have called it rec-id.
9214 @9214 aww jeez man.
Maciej Łoziński
@loziniak
@greggirwin Point taken, my names also don't carry much meaning. But everytime I can, I try to avoid variables like key, index etc.
GiuseppeChillemi
@GiuseppeChillemi

@greggirwin

I'm used to parens in paths from many years of Reboling, though I don't use them often. However, they are still considered an experimental feature in Red, as we are not sure they are worth keeping.

I use it a lot !

Dave Andersen
@dander
@greggirwin, here's a concrete example of using path construction (granted with all indexes in this case). It would probably be better to use word! instead of index in the cases where that is applicable, but then it would need to know if that word! was being reused in that branch of the tree...
Gabriele Santilli
@giesse
@loziniak sure, but, path! is already a block-like type, while pair! is not.
Gregg Irwin
@greggirwin
@dander path construction isn't an issue. That's an alternative, because you're making the path from other parts, not putting parens in a literal path for their evaluative property.
@GiuseppeChellemi examples?
Vladimir Vasilyev
@9214

For the reference, the main argument against paren! in paths is a stylistic one: you can abuse them with multi-line expressions or ungodly mess like inclusion of external files and deeply nested code logic.

head/(
...
<you can embed whole Red runtime here for all I care>
...
)/(
...
)/tail

One path (no pun intended) we can take is to prohibit newlines during path! lexing, thus allowing only simple, single-line expressions. Another is to get rid of them entirely.

Maciej Łoziński
@loziniak
And one more – leave it as it is now, letting a programmer choose her own style.
luce80
@luce80
@greggirwin example:
page: 1 per_page: 10

for page 1 41 1 [
    out: probe join out-head [per_page * page - per_page + 1 "-" per_page * page  ".json.txt" ]
    file: read to-rebol-file out
    probe length? file
    file: head remove/part file 3 ; remove initilal (UTF?) garbage
    json: json-to-block file
    ;probe copy/part mold json 100
    for n 2 11 1 [
        attempt[insert/only tail items json/("html")/("body")/("div")/4/("div")/("div")/("div")/2/("div")/1/("div")/("div")/1/("div")/:n/("div")/1/("div")/("span")]
    ]
    page: page + 1
    if (probe length? file) < 90 [break]; 75
]
probe count: length? items
{
probe items/2/1/("a")/1/("#text") ; creator
probe items/2/1/("a")/2/("@href") ; link
probe items/2/1/("a")/2/("strong")/("#text") ; filename
probe items/2/2/("#text") ; description
}
Gregg Irwin
@greggirwin
@luce80 thanks. String keys are probably the strongest use case for the feature.
But here is another case where doing k: "div" once, and using :k in the path would be a big win. Or :div. :^)
Gregg Irwin
@greggirwin
json/("html")/("body")/("div")/4/("div")/("div")/("div")/2/("div")/1/("div")/("div")/1/("div")/:n/("div")/1/("div")/("span")
json/("html")/("body")/:div/4/:div/:div/:div/2/:div/1/:div/:div/1/:div/:n/:div/1/:div/("span")
json/("html")/("body")/:d/4/:d/:d/:d/2/:d/1/:d/:d/1/:d/:n/:d/1/:d/("span")
Vladimir Vasilyev
@9214
Allowing strings in paths without requiring extra parenthesis would make more sense. But then we end up with the exact same stylistic argument against multi-line {...}.
Gregg Irwin
@greggirwin
Yup.