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
Vladimir Vasilyev
@9214
@MartenH not sure what you mean by "block scope"
Mårten Hildell
@MartenH

@9214 I used the /local in a block and thought it would be the same thing as in C, but it
has function scope and not block scope....

In C this would be:

if( ..) {
   uint32_t hello;
   hello = 1;
}

hello variable would only live in the if block.

Vladimir Vasilyev
@9214
@MartenH I dont' know C that much, but here's the thing - C has lexical scoping, but Red has no scopes at all
Nenad Rakocevic
@dockimbel
@MartenH I strongly suggest reading the Rebol/Core Manual, if you haven't done so yet. You cannot understand Red language from R/S documentation.
Mårten Hildell
@MartenH
The page @dander refers seems to be this, https://en.wikibooks.org/wiki/Rebol_programming/Advanced/Bindology, but it's beyond me at this point
@dockimbel Thanks.... I'm reading there now also.
Vladimir Vasilyev
@9214
here's how you can "localize" the block
>> my-block: [x: 1]
== [x: 1]
>> context my-block
== make object! [
    x: 1
]
>> x
*** Script Error: x has no value
*** Where: catch
*** Stack:
Vladimir Vasilyev
@9214
@dockimbel is it correct to say that only some (or all?) any-function!s are context constructors?
and what's the difference between action!, routine! and native! ?
Nenad Rakocevic
@dockimbel
@9214 That statement is only valid for function! constructors, the other ones are written in R/S, so they don't need a Red context! to operate.
Vladimir Vasilyev
@9214
@dockimbel thanks, though context! is a hidden internal datatype, right?
Nenad Rakocevic
@dockimbel
action! are datatypes "methods", native! are just core functions written in R/S (for performance, simplicity or feasability reasons). routine! are user-written functions with a R/S body (routines exist both in Red and R/S realms at the same time).
Correct, it's not directly exposed to Red level. Though object! and function! both hold a reference to context! values internally.
Vladimir Vasilyev
@9214
I feel a strong itch to dive lower and study system programming either with Forth or R/S :smile:, any suggestions (books/stuff, meditation techniques, etc) taking into account that I only barely know C (~ first 4 K&R chapters)?
Vladimir Vasilyev
@9214
@dockimbel this means that make (action!) isn't context constructor? I mean, not in general, but when it comes to function! and object!.
Nenad Rakocevic
@dockimbel
@9214 Only in those two cases (for now), yes.
Vladimir Vasilyev
@9214

for now

:suspect:

Gregg Irwin
@greggirwin
@RnBrgn, It's possible that Red could provide more information. I can't speak to internal details, but consider that there may be a lot of overhead in tracking things. Only in the simplest cases is your code a single level series of values. Add to that, the ability to dynamically construct and change code, even at runtime, and Red potentially has to maintain a lot of state-location references.
So the question to ask may not be "Can we show line numbers?", but "What is the most helpful information to show, that is also useful when building tools?"
Greg T
@gltewalt
If we had the ability to grab a name from its value, could tell what word error happened at?
Gregg Irwin
@greggirwin
More than one word can refer to the same value. And, again, what do you do when things change dynamically? Yes, we have a lot of cases where that doesn't happen, but if we momentarily forget how things work in other langs, and think in terms of Red...if you were the "Red engine", what would you tell the user?
Greg T
@gltewalt
In this example, does 'a get clobbered twice, or are these actually distinct atoms?
>> set/only [a a a] [1 2 3]
== [1 2 3]
Gregg Irwin
@greggirwin
I don't know what you mean by "clobbered", but a is in the same context. Set will evaluate each word in the word block and set it to reference the appropriate value. Words can't be duplicated in contexts.
>> probe context [a: 1 a: 2]
make object! [
    a: 2
]
Greg T
@gltewalt
I mean rebind the word a each time it appears after the first time
Gregg Irwin
@greggirwin
Yes. Easy to see:
>> set [a a a] [1 2 3]
== [1 2 3]
>> a
== 3
Greg T
@gltewalt
Isn't that different than set/only?
I was wondering if there's really only one a in the set/only example, or if the individual words were identifiable somehow?
Gregg Irwin
@greggirwin
Only in what value is referenced.
>> set [a b c] [1 2 3]
== [1 2 3]
>> print [a b c]
1 2 3
>> set/only [a b c] [1 2 3]
== [1 2 3]
>> print mold reduce [a b c]
[[1 2 3] [1 2 3] [1 2 3]]
Vladimir Vasilyev
@9214
you can't have two identical words with two different meanings in the same context, but you can have two identical words with two different meanings in the same block
RnBrgn
@RnBrgn
@greggirwin thanks for taking the time to respond to my question. There"s always more to it than I realize. But I always learn a bit more with explanations like that.
Gregg Irwin
@greggirwin
@RnBrgn, you're very welcome. Others, lurking, also learn, and I often learn things as I revisit and try to figure out how best to explain them.
@gltewalt, to build on what @9214 said:
>> o-1: object [a: none]
== make object! [
    a: none
]
>> o-2: object [a: none]
== make object! [
    a: none
]
>> blk: reduce ['a  in o-1 'a  in o-2 'a]
== [a a a]
>> blk
== [a a a]
>> set blk [1 2 3]
== [1 2 3]
>> a
== 1
>> probe o-1
make object! [
    a: 2
]
== make object! [
    a: 2
]
>> probe o-2
make object! [
    a: 3
]
== make object! [
    a: 3
]
Getting into binding is a bit deep for the Welcome group, but expanding minds early isn't a bad thing. :^)
Senenmut
@Senenmut
Hi Gregg , i make a break from programming. Just send a message from holidays to the best guys in programming like Red ones are. Such like the best yacht for yachting here in Italy on the Azimut Grande 140 Trideck. Ill be back. http://azimutyachts.me/yachts/list-grande/boat-f-140.html The barbarian.
Gregg Irwin
@greggirwin
:^)
Nathan Douglas
@nd9600
Is there a way to read the parameters for things in the VID or draw dialects?
I try to see what facets something like box needs by trying ? box but it never works
I assume because ? only works for proper Red code, not a dialect
Gregg Irwin
@greggirwin
@nd9600, correct. Help doesn't know about dialects.
Nathan Douglas
@nd9600
Ah so we'll probably just always have to go to the online docs
Gregg Irwin
@greggirwin
No. Someone just needs to write a vid-help function or tool.
That said, there is no standard for dialect reflection, so it's not going to work like help does.
Nathan Douglas
@nd9600
Thanks
Should random return the same values when I run it in different console instances?
I just noticed it always returns first 753, then 781, then 267 if I run random 1000 in different consoles
random/secure 1000 and random/seed 1000 give the same behaviour
It's probably just not done yet
Gregg Irwin
@greggirwin
The RNG is seeded the same by default. You use /seed to give it a different seed, so you can get reproducible results when needed. e.g.
>> random/seed 1000
>> random 1000
== 178
>> random/seed 1000
>> random 1000
== 178
>> random/seed 1001
>> random 1000
== 985