Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Oct 20 2019 22:59
    @dockimbel banned @SmackMacDougal
  • Dec 03 2017 05:53
    @PeterWAWood banned @matrixbot
  • Sep 28 2016 12:19
    @PeterWAWood banned @TimeSeriesLord
  • Aug 13 2016 03:23
    @PeterWAWood banned @Vexercizer
nedzadarek
@nedzadarek

inherent type priority

Is there some reason why there is such priority?

sort/stable [1 2.2 "zzstring" #"_" <atag> #issue 229%]
; == ["zzstring" 1 2.2 #"_" #issue 229% <atag>]

It seems that string! is always before tag!, char! after integer!/float! (understandable). Why char! isn't before/after string? Some any-string! should stick together (I would add char! too)... well is there reason why there is such prority

lepinekong
@lepinekong_twitter
@ne1uno hmm it's not me but maybe I used a lib. will search thanks.
lepinekong
@lepinekong_twitter
@ne1uno you're right It was in altjson.red lib :+1:
@rgchris there is a bug for "use" keyword in altjson.red: probe test1 returns none because a is used at the beginning of comment.
a: 1
b: 2

use ["a b are some variables, weird test1 returns none whereas test2 returns 2"][
    test1: a
    test2: b
    probe test1
    probe test2
]
Vladimir Vasilyev
@9214
@lepinekong_twitter that's not a comment, because first block of use is not a function spec.
Vladimir Vasilyev
@9214
@rgchris :point_up: looks like you need to do additional sanity checks :wink:
ne1uno
@ne1uno
I think altjson in his scripts repo doesn't use use https://github.com/rgchris/Scripts/
ne1uno
@ne1uno
looks like a macro local to color-code, not used in altjson? not that it's not worth understanding how it was intended to work. just probably newer code as well
did rebol have a bigger problem leaking context? use seems like a solution in search of a problem in red
Vladimir Vasilyev
@9214
@ne1uno it's the user who leaks words into global context, not the language.
nedzadarek
@nedzadarek
How do I use function/extern in Red? In Rebol I could just do this: var1: 42 f: funct/extern [a] [var1: a] [var1]
Vladimir Vasilyev
@9214
@nedzadarek
>> x: 1
== 1
>> foo: function [a /extern x][x: x + a]
== func [a][x: x + a]
>> foo 10
== 11
>> x
== 11
nedzadarek
@nedzadarek
@9214 thank you.
Ah, it's like /local. ? is little misleading in case of function.
Vladimir Vasilyev
@9214
@nedzadarek it's not like /local, it's the exact opposite.
function does a deep-traversal and localizes all set-words it sees, /extern is a way to say which set-words should not be localized.
nedzadarek
@nedzadarek
@9214 I mean.. syntactically (?) - you use it in the spec like /local vars.
Vladimir Vasilyev
@9214
@nedzadarek it's called a refinement though. Both /local and /extern are refinements.
Except that you can't use /extern after function creation.
nedzadarek
@nedzadarek
Yes, /local and /extern are values of type refinement!. However when you use function!s you expect usage like this <name of function>/refinement1/refinement2 var1 var2 ref1-var1 ref2-var1.
Vladimir Vasilyev
@9214
And..?
nedzadarek
@nedzadarek
It's just little misleading. Never mind. btw. do you know other function that use pattern like (function functtion-name [var /ref ...] body?
Vladimir Vasilyev
@9214
Red have built-in function, func, does and has function constructors, if that's what you mean.
This spec format is a dialect, specific for everything that inherits make function! ...
nedzadarek
@nedzadarek
@9214 No, I mean functions that use refinement!. Not like this: foo/ref1/ref2 .... But like this: foo [var /ref1 something something-else /ref2 another-thing] some-var.
Vladimir Vasilyev
@9214
@nedzadarek have you read what I said about function spec dialect?
You can build function constructor yourself, and make it use the same format or a newly designed one (@rebolek has a couple of examples for that).
nedzadarek
@nedzadarek
@9214 Yes, I read it. It's (mini) dialect. I wonder if (and how) other people use that too.
I have seen that rebolek's work.
Boleslav Březovský
@rebolek
function constructors FTW!
Vladimir Vasilyev
@9214
@nedzadarek other people (including you) use it regularly whenever they create a new function with func or function.
nedzadarek
@nedzadarek
@9214 I mean... beside func or function.
Vladimir Vasilyev
@9214
Jeez, have you read what I said?
does and has are just shortcuts, there're no other natives that use this dialect.
nedzadarek
@nedzadarek
Ok, so If understand it correctly no other built-in function uses refinement! (in mini-dialect)?
Vladimir Vasilyev
@9214
@nedzadarek there are no other built-in function constructors, aside from func and function (skipping does and has here), hence there's no other functions that use the spec dialect.
Except maybe for make itself.
nedzadarek
@nedzadarek
@9214 Great info! Thank you.
It seems refinement! is not used by many things after you create things (func/function/make etc.).
With foo: func [/a /b /c] [42], foo/a/b/c is just a path!; when it's executed, Red will just create 3 variables (a, b and c).
Vladimir Vasilyev
@9214

Red will just create 3 variables

it won't create anything (especially "variables")

The value of these words inside function's context will be changed from false to true if you supply them as refinements.
nedzadarek
@nedzadarek
Yes, that what I mean... in less technical way.
Vladimir Vasilyev
@9214
So as with refinement arguments, they'll change from default none to the value that you supplied.
It's not a technical way, it's how language works. You keep confusing yourself and others with false concepts and mental models.
nedzadarek
@nedzadarek
I'm not confused. It's just in that example it really didn't matter whenever or not a, b and c existed. If that confused someone - I'm sorry.
Boleslav Březovský
@rebolek
Every word declared in function header exists in function context.
Vladimir Vasilyev
@9214
@nedzadarek what you said in "Red will just create 3 variables ..." I interpreted as "Red will populate global context with 3 new words set to some value".
nedzadarek
@nedzadarek
@9214 Well... you are right. I just assumed "local variables" by saying "variables". My bad. Sorry for confusion!
Vladimir Vasilyev
@9214
@rebolek do I sound like a pedant to you?
Anyway, once more with pedantry - words, not variables!