Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jul 01 2018 17:34
    @greggirwin banned @BIjeuca_twitter
  • Dec 03 2017 05:53
    @PeterWAWood banned @matrixbot
  • Sep 28 2016 12:20
    @PeterWAWood banned @TimeSeriesLord
GiuseppeChillemi
@GiuseppeChillemi
It is FLOW of CODE: any word which makes up your code
Vladimir Vasilyev
@9214
and why not just "block"?
GiuseppeChillemi
@GiuseppeChillemi

When you:

STR: "" ;""  is data structure position 2
insert STR "ah"
STR: "" ;"" is data structure position 7
insert STR "bb"

you are stating: SET STR to what you find at position 2 of your data structure ("")
Then: insert on what is rapresented in position 5 (word "ah") on position 2
Then: set STR to what is rapresented in position 7 (second "") and use THIS POSITION in further reference to get/set the contend of STR
then insert on POSITION 7 "bb"
If this code loops, the first STR will take again the value "ah" insted of "BB" as it will use the content of position 2. The second one will use te conent of position 7.

So the first insert STR "ah" will have as result "ahah" at the second loop
Alexander Higgins
@cahiggins
that makes sense now
GiuseppeChillemi
@GiuseppeChillemi
@cahiggins After more than 10 years of REBOL it now makes sense to me too. It is important to help other users to "disconnect" to their old knowledge and connect to the new one.
I can say I am out of the matrix now !
Vladimir Vasilyev
@9214
here's another food for thought - think about how it all mixes together with bind and contexts
GiuseppeChillemi
@GiuseppeChillemi
@9214 Bind, contexts, reduce, form, mold, set, pick, blocks, system/words, parse, dialects.... I have to start over with new eyes.
there is no spoon !
I am a borg ! I am part of the group. We all say "there is no spoon". You will be assimilated to the 'NO SPOON" logic. Resistence is futile.
Vladimir Vasilyev
@9214
for that matter, the next step is to accept that there's no I
Boleslav Březovský
@rebolek
Carl has described Rebol script as series of values which is best description IMO.
Vladimir Vasilyev
@9214
@rebolek well, yeah, since script can be in various forms (block!, string!, binary!)
Boleslav Březovský
@rebolek
Yes, but it loads as block! anyway.
PeterWAWood
@PeterWAWood

Carl also refers to Rebol scripts as expressions. He says "REBOL Expressions are based on this concept: you combine values and words into blocks".

The chapter Expressions in the Rebol User Guide is pretty much essential reading.

Boleslav Březovský
@rebolek
I agree. Basically the whole book is essential reading.
geekyi
@geekyi
image.png

@dockimbel :point_up: September 29, 2017 12:13 PM

@geekyi How to do you end up with those counts?

I used a program that reads strings in memory

geekyi
@geekyi
Interestingly, I can also write to memory (notice the Blu):
image.png
geekyi @geekyi rubs hands (using this to debug the internals would be fun)
geekyi
@geekyi
This is also easier for anyone to get started with, than most other programs I tried(this particular functionality was just hidden very deep)
Nenad Rakocevic
@dockimbel
@geekyi Such extra copies could be created by the OS or the C library, as you are reading through the whole process's memory.
geekyi
@geekyi
Yes, some of them seem to be 2-byte encodings
Nenad Rakocevic
@dockimbel
That's UTF-16 strings, used by Windows API.
Gregg Irwin
@greggirwin
:point_up: September 30, 2017 1:19 AM @9214, save this somewhere. I like this explanation.
Vladimir Vasilyev
@9214
@greggirwin :muscle:, though, I need to meditate on how to blend this all together with bindology and other features nicely
Gregg Irwin
@greggirwin
Yes, but it's a nice "visual" metaphor.
GiuseppeChillemi
@GiuseppeChillemi
@greggirwin Yes, it add a missing block: code is itself memory where you store, retrieve and interpret.
Greg T
@gltewalt
Will there be a mechanism in the future to prevent code injection or 'not so nice' foreign code?
Boleslav Březovský
@rebolek
There already are such ways, construct, etc.
Gregg Irwin
@greggirwin
Dialects are also a major pattern for preventing code injection. You will likely never be able to safely do untrusted code.
Nenad Rakocevic
@dockimbel
@gltewalt do cannot be secured, but it should be possible to sandbox untrusted code, by blocking some language features.
GiuseppeChillemi
@GiuseppeChillemi
Now that I have understood "there is no spoon" I want to move to the next step: how is the code interpreted ? From loading the script to the very first steps
Gregg Irwin
@greggirwin

@GiuseppeChillemi, lexical scanning is the first step. Parsing and tokenizing the input to find Red values in the text, and determining if the input is valid. That is, it contains all valid Red values.

At that point you have a block of values. Think about how you, as a human, interpret that. You know some values are direct values, like numbers. But what happens when you find a word? You need to determine what to do. What kind of word is it? What is the behavior of each kind of word?

David Viner
@RiVeND
@greggirwin Thanks for that, Gregg :thumbsup: . I always find I have better comprehension of a system if I can picture what's going on under the hood. Maybe, when the documentation efforts get off the ground, those with more in-depth knowledge of Red could produce some simple flowcharts of what the more complex parts do (such as parse). I know they would definitely help me get a better grip on the language.
Gregg Irwin
@greggirwin

Glad if it helped a bit @RiVeND. Parse is deep, and hard to describe in prose/text, because the behavior and data mixture will be verbose. An interactive tool will be much better, so you can see what rule is being evaluated, the current location in the input, and maybe hints about keyword behavior. e.g. if ahead is evaluated, a "does not advance" indicator could light up.

There was an old parsing tool, VisualParse++, from Sandstone technology, that did something like that. It was a shift-reduce parsing tool, and was pretty cool.

GiuseppeChillemi
@GiuseppeChillemi
How datatypes are associated to each element of the block ?
Dave Andersen
@dander
@GiuseppeChillemi the elements of a block are all values, and every value has a type. All values in Red are 'boxed', and the box contains both the type and data structure which represents the value
Gregg Irwin
@greggirwin
@GiuseppeChillemi, to add to @dander's answer, you can think of blocks as having "value slots" that refer to values. The block doesn't know, or care, what type of value is in each slot.
Mårten Hildell
@MartenH

Hi
I'm new to the language and I'm trying to do something that I think is quite simple, but I fail.
I just want to convert a hexadecimal byte that is on string format to a binary value.

Something that works:

t: #"^(AB)"
a: to binary! to-hex/size (to integer! t) 2
print a

I now want to "construct" t so that "AB" can be a string, ie construct a character from a string if that makes any sense.

I know that are other ways to do this but this got interesting.

Vladimir Vasilyev
@9214
?
>> skip to binary! #"^(AB)" 1
== #{AB}
idk if that will work for you in general case
Nenad Rakocevic
@dockimbel
@MartenH
t: #"^(AB)"
append a: #{} to-integer t

== #{AB}

construct a character from a string

A string is composed of characters, so such wording doesn't make much sense in this context. You might want to extract a character from a string rather.

Mårten Hildell
@MartenH

Thanks for the responses.
I'm know I'm missing something fundamental but I still don't understand how to create t in this case.

Assume "AB" is held in a string! how to I create t ?

str: "AB"
t: ????
Petr Krenzelok
@pekr
load rejoin ["#{" "AB" "}"] ; though not sure it is a safe aproach ...
Vladimir Vasilyev
@9214
@MartenH
>> str: "AB"
>> load rejoin [{#"^^(} str {)"}]
== #"«"
ah, @pekr was faster :)