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
Gregg Irwin
@greggirwin
Yes! Well played.
Vladimir Vasilyev
@9214
though, I still can't bridge that mental gap between when data is evaluated and becomes another data
Gregg Irwin
@greggirwin
Now you can edit your post and say "What cup?"
Vladimir Vasilyev
@9214
I mean, code is what to do, something active, and data is something to manipulate upon, something passive
if everything is data and everything is passive, how something can happen at all?
Greg T
@gltewalt
Do!
Vladimir Vasilyev
@9214
I know that this active/passive presupposition is lame and it comes from another languages, but it just doesn't click
well, do is data too
and of course you can do do, but then first do is data too...
Greg T
@gltewalt
The word is
The soul is the evaluator, isn't it?
Vladimir Vasilyev
@9214
uh-uh, so at least evaluator is code
Greg T
@gltewalt
I'm guessing
We will have to consult @dockimbel for deep diving, I think
Vladimir Vasilyev
@9214
It actually make sense if you think of a Red program as a copy book with simple math: you see 1 + 2 on the paper and you write down answer on the same paper. 1 + 2 is data, but then you process it and come up with an answer, it's a code, but only in your head.
@gltewalt 2deep4me
how can you, oh mighty Redbol gurus, live on such mental heights without your head exploding?
well, Frankenstein is a corpse until it's explicitly revived by an electricity :shipit:
Greg T
@gltewalt
So there has to be some force or 'do', right? It can't all be inert data, can it?
Vladimir Vasilyev
@9214
it all boils down to the fact that our Universe consists of strings and at the center of the Universe is a tiny Red v42.0.0 interpreter that constantly performs do load on everything
it's that simple, no Ph.D required
Greg T
@gltewalt

@GiuseppeChillemi You might want clear, but it's important to learn the copy way.

print-it: func [/local str][
    str: ""
    insert str "ha"
    print str
    clear str
]

Many print-it:

loop 20 [print-it "ha"]
sptorin
@sptorin_twitter
@9214 @greggirwin read your last messages and head explodes twice... Let a: "1234567890" and after a: "". This mean what somewhere in memory exist string "1234567890" and word a bound to it. After this we create new string "" and bound a to it. Now no one pointer look on "1234567890" - and this string must be garbage collected?
Vladimir Vasilyev
@9214
@sptorin_twitter tricky question
Gregg Irwin
@greggirwin
@sptorin_twitter, my guess is that the string can't be collected as long as the function exists. i.e. there is a value slot in the function body for that string, even though no word refers to it.
Vladimir Vasilyev
@9214
my thoughts are that as long as something is a part of the data (and everything is data), it can't just disappear (unless you explicitly delete it, i.e. modify data at run-time)
sptorin
@sptorin_twitter
a: "qwerty"
b: "qwerty"
c: "qwerty"
a, b, c - bounds to same data "qwerty"? In compiler mode, in interpreter mode?
PeterWAWood
@PeterWAWood
@sptorin_twitter Each of a, b and c are bound to a string! value. All three string! values initially contain the characters q,w,e,r,t, and y
>> a: "qwerty"
== "qwerty"
>> b: "qwerty"
== "qwerty"
>> c: "qwerty"
== "qwerty"
>> append a "a"
== "qwertya"
>> append b "b"
== "qwertyb"
>> append c "c"
== "qwertyc"
>> a
== "qwertya"
>> b
== "qwertyb"
>> c
== "qwertyc
This is how to bind words to the same value:
>> a: b: c: "qwerty"
== "qwerty"
>> append a "abc"
== "qwertyabc"
>> b
== "qwertyabc"
sptorin
@sptorin_twitter

@PeterWAWood this make three string in memory?

a: "qwerty"
b: "qwerty"
c: "qwerty"

If we look at your first example, this right - now three string in memory with content "qwerty"

Now make:

a: "qwerty"
a: "qwerty"
a: "qwerty"

Againg three string in memory?

PeterWAWood
@PeterWAWood

On reflection, it probably doesn't but I'm not certain.

If it does then values that are not bound to a word! or included in a collection (e.g. block!) will be garbage collected, once the garbage collector has been implemented.

sptorin
@sptorin_twitter
loop 100 [a: "qwerty"] - 100 times bound a to same value? Because value in block!?
PeterWAWood
@PeterWAWood
I think that a is bound to the value "qwerty" in the first line, in the second and third lines, Red does not rebind to a new value.
PeterWAWood
@PeterWAWood
>> stats
== 3317760
>> loop 100000 [a: "qwerty"]
== "qwerty"
>> stats
== 3317760
>> loop 100000 [a: copy "qwerty"]
== "qwerty"
>> stats
== 6238208
As I understand, set-word!s evaluate differently if the word needs to be added to the context from when the word has already been added to the context.
geekyi
@geekyi

Typing out a word(without pressing enter) creates 4 instances. Of those, 2 instances are 2-byte word encodings, one is history of whole console.
Pressing enter gives me an obvious error about the word having no value, and 8 more instances are created (which includes the error message).
Note that it's all done in the console on Win10.

So, depending on how things are done, it may take up different memory in ways one wouldn't have thought!
Also, being alpha software, there's still space for much improvement here.

GiuseppeChillemi
@GiuseppeChillemi
@9214 @greggirwin read your last messages and head explodes twice... Let a: "1234567890" and after a: "". This mean what somewhere in memory exist string "1234567890" and word a bound to it. After this we create new string "" and bound a to it. Now no one pointer look on "1234567890" - and this string must be garbage collected?
The answer has still not solved some points like this. Hope @dockimbel will help clarify.
Gregg Irwin
@greggirwin
I answered that as best I could @GiuseppeChillemi. If nothing refers to a value, it may be garbage collected. As long as something refers to it, it can't. :point_up: September 27, 2017 11:50 AM may be corrected by @dockimbel, but these are also details that could change, and may not be worth time answering right now.
When implementation details like this become important is when they affect users directly.
Nenad Rakocevic
@dockimbel
@geekyi How to do you end up with those counts?

@GiuseppeChillemi

The answer has still not solved some points like this. Hope @dockimbel will help clarify.

I'm not sure what is missing from above explanations, but to answer your question, a series which is no longer referenced anywhere will be garbage -collected. If you put that string in a function body block, it is referenced.

Nenad Rakocevic
@dockimbel

@9214

how can you, oh mighty Redbol gurus, live on such mental heights without your head exploding?

With Redbol, it's most of time simpler than you think. I'm trying to write down some general explanations of the core concept, for the Red documentation and eventually a blog article.

Vladimir Vasilyev
@9214
@dockimbel that will be great, because I feel that I lack strong mental model of what is really happening then I program in Redbol and it kinda limits my power. I would say that freedom is truly paralyzing ;)
btw, currently only series! could be modified in-place, am I right that with ref! datatype such self-modification will be doable with everything?
Rudolf Meijer
@meijeru
I thought that ref! was a re-designed issue!... :worried:
Boleslav Březovský
@rebolek
IIRC ref! is for @name
(I’m not sure why, but I can't type @ in Firefox, I have to copy it)
PeterWAWood
@PeterWAWood
@9214 I'm not certain that "currently only series! could be modified in-place" is correct. Though I may not understand what you are saying. object! and map! values can be modified in place. I believe that pair! and tuple! values can be modified in place.