Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Sep 17 22:14
    greggirwin commented #192
  • Sep 17 22:14

    greggirwin on master

    docs-cs: recent changes (image.… Merge branch 'master' of https:… docs-cs: cs\datatypes\map.adoc… and 1 more (compare)

  • Sep 17 22:14
    greggirwin closed #192
  • Sep 16 07:43
    qtxie transferred #197
  • Sep 16 07:39
    meijeru opened #197
  • Sep 15 18:30
    Tovim reopened #192
  • Sep 15 18:30
    Tovim closed #192
  • Sep 15 18:29
    Tovim reopened #192
  • Sep 15 18:28
    Tovim closed #192
  • Sep 15 18:19
    Tovim synchronize #192
  • Sep 11 17:02
    dockimbel opened #196
  • Sep 11 16:45
    dockimbel opened #195
  • Sep 11 16:45
    dockimbel opened #194
  • Sep 09 02:16

    greggirwin on master

    Added iteration section for map… Changed wording in Iteration se… Merge pull request #193 from gl… (compare)

  • Sep 09 02:16
    greggirwin closed #193
  • Sep 08 21:39
    gltewalt synchronize #193
  • Sep 07 21:11
    gltewalt opened #193
  • Sep 07 07:12
    Tovim opened #192
  • Sep 06 18:31
    hiiamboris opened #191
  • Sep 06 00:50
    x8x commented #14
Gregg Irwin
@greggirwin
@gltewalt backward meaning that floats should always contain 8 bytes? Or that zero bytes are not prepended?
@dockimbel, should floats convert to char!? I know it's easy, but what is the use case?
nedzadarek
@nedzadarek
@greggirwin I think he meant "as floating point number" part.
Phryxe
@Phryxe
The link from "The source code for the gpio:// scheme can be found there." in latest article shows a 404 error.
There is another dead link to the same file in the end of the article.
Semseddin Moldibi
@endo64
Thanks @Phryxe
Correct URL should be https://github.com/red/red/blob/master/environment/schemes/GPIO.red I'll inform the team.
Vladimir Vasilyev
@9214
@Phryxe thanks, fixed. Article was written prior to port-type branch being merged into master.
ralfwenske
@ralfwenske

In https://doc.red-lang.org/en/preprocessor.html is this example

Red []
#macro pow2: func [n][to integer! n ** 2]
print pow2 10
print pow2 3 + pow2 4 = pow2 5

last line should be:

print [pow2 3 "+" pow2 4 "=" pow2 5]
Gregg Irwin
@greggirwin
@gltewalt :point_up:
Semseddin Moldibi
@endo64
@ralfwenske I think not, when you compile your script, the output is as below: (different from running the script in REPL)
D:\test.exe
100
true

And you can see the details by using expand-directives:

Red []
#macro pow2: func [n][to integer! n ** 2]
print pow2 10
print pow2 3 + pow2 4 = pow2 5
probe expand-directives [pow2 3 + pow2 4 = pow2 5]

Output:

100
true
[9 + 16 = 25]
ralfwenske
@ralfwenske
Thanks @endo64 I start to realise that preprocessing for interpreter doesn’t make that much sense.
(… would be nice though if we could say what runs interpreted runs compiled - and vice versa :) )
Semseddin Moldibi
@endo64

Yes, that is a limitation, but may be change in the future.
2 other points:

You can also see the expanded version of your script by using --show-expanded argument during the compilation, for easier debugging:

Red []
#macro pow2: func [n][to integer! n ** 2]
print pow2 10

Output:

Compiling D:\Projects\Red\red\build\bin\test.red ...
...using libRedRT built on 30-Jul-2019/13:43:21
[
    print 100
]
...compilation time : 29 ms
Semseddin Moldibi
@endo64

And you may examine system/lexer/pre-load, default value is none but if you put a function there it will be called during the scanning (on REPL only, no effect on compiled exe)

>> system/lexer/pre-load: func [s] [replace s "*" "+"]
== func [s][replace s "*" "+"]
>> 3 * 5
== 8

It can be used to extend to replace macros on REPL. There are better examples for use of pre-loader from @toomasv and others.

Vladimir Vasilyev
@9214

would be nice though if we could say what runs interpreted runs compiled - and vice versa

Everything wrapped in do [...] is interpreted, the rest is statically compiled. With -e everything is interpreted.

@endo64 I would argue against suggesting pre-load to newcomers (and pretty much everyone else), not until we get a decent reader macros support.

And you don't need compilation with -s, using expand from console is enough for quick experiments.

ralfwenske
@ralfwenske
Thanks @endo64 @9214 It all is a great learning experience - and I enjoy very much the language (Rebol/Red) plus this great helpful community. Thank you all.
Semseddin Moldibi
@endo64
@9214 You are right, promoting pre-load is not a good idea, I just mention it because @ralfwenske said that he wants to learn & play with different aspects.
Rudolf Meijer
@meijeru
An interesting feature emerged from discussion of issue #3359: it is allowed to make action and native values. This is basically because the toolchain itself uses make to pre-define all actions and natives, and it was not deemed necessary or useful to forbid this feature after the initialization phase. However, (1) only existing actions and natives can be (re)made, and (2) the function spec has to be suppplied and if you get that wrong, a crash may occur. In "my" spec document, I have added wording to the effect that this is not recommened. Apparently, R3 alllowed it, but R2 did not.
Gregg Irwin
@greggirwin
The above link should be red/red#3359
Rudolf Meijer
@meijeru
Correct. Any comments on the substance?
Gregg Irwin
@greggirwin
Nenad's comment on the ticket itself seems sufficient.
Rudolf Meijer
@meijeru

Something to note somewhere: a comma , is allowed as replacement for the decimal point. Now because floating point numbers starting with a decimal point are allowed, and on the other hand a decimal point is also allowed in a word! value, one has the following possibilities:

>> b: load "a,1" print [mold b type? b]
[a 0.1] block
>> b: load "a.1" print [mold b type? b]
a.1 word

It appears that a number starting with a comma does not need to be separated from a preceding word by whitespace.

Vladimir Vasilyev
@9214
@meijeru red/red#3569
Rudolf Meijer
@meijeru
My point is different from that in the issue quoted: it is about the need for separation...
Also, it is not a bug/issue, just a note worth documenting.
Rudolf Meijer
@meijeru
Another gotcha: in order to check if a function refinement has been specified in the call, the function body can do an if <refinement> but when the refinement carries further arguments, one sometimes sees a check on those directly: if <optional-argument>. I could cite various lines in the Red toolchain code. This works most of the time, since optional arguments which are not present in the call are initialized to none. However, when the type of the optional argument is logic! and it IS present in the call as false, this if breaks down.
Vladimir Vasilyev
@9214
Are there any functions in Red codebase that use more than single argument for their refinements?
Rudolf Meijer
@meijeru
Do you mean like func [... /a b c ...] ?
Vladimir Vasilyev
@9214
@meijeru yes.
Rudolf Meijer
@meijeru
That has no bearing on my above remarks. The problem starts when you do, inside the body of the function: if b [... use b ...] instead of if a [ ... use b ...] and a happens to be true i.e. specified, and b happens to be false. Then the first coding idiom is dangerous.
Vladimir Vasilyev
@9214

@meijeru my point was - why separation between refinements and their arguments exist in the first place, if, as far as I know, most refinements use only one argument? You can, in theory, just use refinement value itself as an argument.

func [/refinement argument][if refinement [use argument]] ; refinement is just a flag, argument bears the actual value

vs

func [/refinement][if refinement [use refinement]] ; refinement carries the value AND serves as a flag of its presence

Your example is a "desync" of refinement and its argument. In what I described above there's nothing to synchronize in the first place, but... cases where refinement is logic! or none! are still tricky.

What your idiom states is "first check refinement, which is always logic!, then check and use its argument(s), which, by design, may or may not be an actual logic! or none! value(s)".
Rudolf Meijer
@meijeru
This is an interesting design point. But how would you do this lexically? In order to specify the expression which is the value of the refinement, before making the call, you would have to do something like /refinement: <expr>, introducing a "refinement set-word".
Vladimir Vasilyev
@9214
@meijeru uhm... there's no need for additional lexical forms. You just don't specify arguments and use refinement itself as a (typed) argument. Nevermind though, it's unrelated to our discussion. But it's worth checking R2, R3 and Red code for presence of more than single argument for refinements - that would actualize the language design point. Functions with more than 3 arguments (both mandatory and optional) is already a code smell, so, we need some baseline to argue when it comes to library implementations and coding style.
Rudolf Meijer
@meijeru
@dockimbel What do YOU think?
Gregg Irwin
@greggirwin
I don't know of any standard funcs that take more than one refinement arg, but I have written funcs like that myself in the past. There is no problem, and nothing special about logic args. You have to code for them just as you would anywhere else, when a value can be none or false.
Rudolf Meijer
@meijeru
@9214 I find the discussion about refinement usage worth pursuing a bit more, but have addressed it in a private message.
Rudolf Meijer
@meijeru
@gregg See layout in VID.red. It is the only example in the whole codebase with a refinement (/parent) that has 2 arguments... How I know? I did an exhaustive search by program, which is just a variation on the different programs like the concordance that I have previously written..
Vladimir Vasilyev
@9214
@meijeru it's interesting how this pattern parallels common Forth idiom - use no more than 3 cells on a stack; something to note on "Red for X" pages.
Gregg Irwin
@greggirwin
Thanks for the research @meijeru !
Dave Andersen
@dander
should the properties with spaces such as line width here be hyphenated instead?
nedzadarek
@nedzadarek

Is it worth linking to the url wiki definition (or its translations) in the url documentations?
I mean this line:

== Abstract

An url! value represents a reference to a network resource and allows for directly expressing Uniform Resource Locators.

Gregg Irwin
@greggirwin
I don't think so. Either we choose a single ref, or clutter with multiple links to wikipedia, IETF specs, etc.
Vladimir Vasilyev
@9214
@greggirwin red/docs#190
Gregg Irwin
@greggirwin
Thanks!
hiiamboris
@hiiamboris
Regarding https://github.com/red/red/issues/3337#issuecomment-528502174 (the last @dockimbel's comment), I believe it should be noted in the reactivity docs that deep-reactor! tracks changes not only in series but also in composite scalars (pairs, tuples, date, time). In contrast to reactor! that does not.
Gregg Irwin
@greggirwin
@hiiamboris agreed. Would you please open a ticket in the red/docs repo for that?
hiiamboris
@hiiamboris
mkay