Rendered at 23:13:03 GMT+0000 (Coordinated Universal Time) with Cloudflare Workers.
kryptiskt 7 hours ago [-]
I'm a bit surprised that Red still seems stuck at 32 bits, like it was last time I saw something about it years ago. What is the roadblock that prevents them from building 64-bit binaries? I guess it must be very hard since otherwise it would have already been fixed.
em-bee 7 hours ago [-]
i think the holdup is the lack of self-hosting. probably the rebol compiler they use can only build 32bit binaries so self-hosting and 64bit support go together.
it's on the milestone for 1.0. and according to the roadmap 1.0 is a solid year of work. it's likely not the only thing they want to do for 1.0, but i guess self-hosting is a big chunk
rebolek 3 hours ago [-]
No, even Rebol2 can build 64 bit but the whole compiler needs to be rewritten to produce 64 bit binaries. It’s not limitation but deliberate choice made when 32 bit was still major target. It may seem silly in the hindsight. But it made sense then.
rebolek 2 hours ago [-]
I always love to see Rebol and Red mentioned anywhere, as I spent more than half of my life with these languages, working with them and working on them.
Recently I started working on [Recoil](https://recoil.rblk.eu/) which is inspired by Rebol/Red but targets static memory-safe compiled niche to complement dynamic interpreted nature of Rebol. It’s still in very early phase but it already has some very nice features (at least I consider them very nice) like fully compiler owned `parse`, finite state machine and (lazy) finite state transducer datatypes.
Oh, and built-in Rebol-like scripting language that can run on (not only) ESP32 called F00.
It’s still work in progress but I like it. Maybe someone else can find it interesting too.
andsoitis 8 hours ago [-]
> We must free ourselves of the hope that the sea will ever rest. We must learn to sail in high winds. -Aristotle Onassis
Love that quote. More poetic than my quip “Hope is not a strategy”.
i'd be curious if red can be used as a commandline shell. the syntax should work well with it. it may just need some wrapper functions to be able to call external programs, pass arguments to them and capture the output.
klibertp 6 hours ago [-]
Not sure why it wouldn't be usable for that:
-▶ ./red-cli-066
--== Red 0.6.6 ==--
Type HELP for starting information.
>> call/console "echo 123"
123
== 0
>> call/console "pwd"
/home/cji/portless
== 0
`call` has a bunch of refinements (toggles or switches appended to the function name with a slash; I'm using /console to redirect output to the parent's stdout), but it's a pretty low-level interface. You definitely could define a few simple helpers and get to a usable Unix-like shell pretty quickly. You'd get native AOT compilation for all your shell scripts for free.
The problem is that you could write those helpers in just about any language, and while Red has an edge over many due to the regular and simple syntax, it's by no means unique in that regard (TCL is an obvious alternative, Lisp-likes are also strong, and even Smalltalk could join the chat if you don't care too much about startup time). And 32-bit-only thing doesn't look good, even if it's not an actual problem in most cases.
In short: it can, but why would you? (Don't get me wrong: I like Red! But with so many other interesting languages (if you're willing to look past TIOBE Top 20), it's hard to justify investing more time into learning Red in particular.)
em-bee 3 hours ago [-]
that was kind of a rhetoric question. i was already pretty sure it would work. so the real question is what is actually needed.
i found the call documentation. that's a good start, but that is pretty much what every other language also provides. what is still needed is a wrapper that allows me to write
somestr: some command --with arguments
and have that string be populated with the "some" command output. but then we also need to capture stderr and the exit value, so we actually need to capture three return values. next, support for pipes in some form would also be needed.
i have worked with lisp and smalltalk and also TCL so i am aware of course.
with so many other interesting languages, it's hard to justify investing more time into learning Red in particular
i actually find red in particular one of the more interesting languages. alongside lisp and smalltalk. haskell, erlang and ocaml are also interesting, but for shell use i am specifically looking at languages that use whitespace as an argument and value separator and which allow complex expressions to be written on one line, since that happens often in shell commands. that reduces the list of interesting languages quite a lot. if you know any others that you think are worth learning, please share.
btw, your website seems to be down.
klibertp 1 hours ago [-]
Ah, yeah, that makes sense, then.
I tried writing a shell in GNU Smalltalk, but had to mess with the parser - otherwise, the need to parenthesize subexpressions makes it really tedious. I implemented |> as a pseudo-operator that implicitly parenthesized everything before it, which was then removed from the expression. It worked for many simple cases, but wasn't pretty and quickly broke down for more complex ones.
I think the only other language worth investigating in this context is Raku. I avoided it for a long time due to its PERL ancestry, but it's actually a pretty well-designed language, and supports multimethods and overloading of pre-/post-/in- and circumfix operators. The operators support precedence and associativity. If you want an embedded DSL for shell one-liners, I think Raku could deliver. It unfortunately uses the comma for argument separation; you could maybe work around that with quotations and macros, but last I checked, these were experimental and not documented. There was a major effort to move to a better-designed parser that would support AST-based macros, but I'm not sure how far along that is today.
Io would work, though you'd also need to mess with a parser a bit (it's runtime-extensible, though, and also allows circumfix operators and passing unevaluated code as Message objects, which is very helpful in this case). Arguments are normally in parens and comma-separated, but you can simply ignore that. This: `some command --with arguments` is actually a valid Io expression (if `--` is a prefix operator), and since you're not evaluating the code, it doesn't matter if it doesn't make sense semantically. But Io is not very actively maintained (a shame!) It's still a very interesting design. It's described in "Seven Languages in Seven Weeks", if you want a quick intro.
Prolog would probably work, but you'd need to write a metainterpreter - otherwise, threading state in/out of predicates through logic variables would be a nightmare in the CLI. There's also the issue of commas as separators.
You know of TCL, so no need to mention it, though it is a pretty nice fit. A more exotic direction could be concatenative languages: maybe Factor, or Joy, or Kitten. All either experimental or unmaintained, currently. They tend to use whitespace for a separator, and I think they all allow for passing around unevaluated code one way or another.
Looking at the list - Red does look like one of the better candidates, but in normal Red code, all functions know their arity. This means you don't need separators for expressions. It doesn't work that way for shell commands, so you'd probably need to write a Parse grammar, include a separator to allow for variadic commands, and then, after splitting into subcommands, interpret the block command by command. I'm sorry, I'm not too knowledgeable about Red, so I can't give you more details, but that should be the general shape: `shell [ var: cmd1 arg --switch arg2 <some_separator> cmd2 <some_symbol>var ]` where `shell` passes the block to parse, gets a list of commands (including ones that bind results, which would appear as `var_name,command` pair; also, I think path expressions can be used in assignment, so `var/stderr: some command` could be included and handled easily), then walks through the list while setting vars and interpolating them in the following commands. Handling piping wouldn't be much harder than extending the Parse grammar and handling pipelines in the interpreting phase. Finally, you could add refinements on shell for simpler cases (just return exit code, capture all output, etc.) Subshells could be just nested blocks. Thinking about it, it could be a pretty fun way to learn more about Red. Ping me if you end up creating something like that, I'd be very interested to read :)
> btw, your website seems to be down.
I know - I broke my homegrown SSG some time ago and never had the time to fix it :( EDIT: restored some version of the site, 90% of the content still missing.
ulbu 5 hours ago [-]
I think they mean red as a shell scripting/command line language.
klibertp 5 hours ago [-]
All that shell scripting needs is the ability to spawn processes and connect their stdin/out/err together. Or at least, that's what distinguishes "scripting" from "shell scripting". Obviously, you can write a library (I like Python's Plumbum) in almost any language you like that provides this functionality conveniently. So, again: yes, Red can be used for that just as well as any other language (and, arguably, it may be better for this use than many others).
For an interactive shell, you also need a REPL, which Red provides. So if you write that library for Red, you get the interactive shell for free.
Yes, Red has many advantages: it can AOT compile to native, it's homoiconic, it has a built-in Parse dialect (so the library can be really ergonomic), the Red executable is tiny and starts up fast, it has native GUI capabilities (if you're in a Red-based shell and want to view an image, it's trivial to create a GUI window and display it there). I'm not saying Red would be a bad choice. I'm just not sure it would be my choice, given the existence of, e.g., Chicken Scheme or Smalltalk/X.
naltun 8 hours ago [-]
Always nice to see Red updates (thanks for sharing)
it's on the milestone for 1.0. and according to the roadmap 1.0 is a solid year of work. it's likely not the only thing they want to do for 1.0, but i guess self-hosting is a big chunk
Recently I started working on [Recoil](https://recoil.rblk.eu/) which is inspired by Rebol/Red but targets static memory-safe compiled niche to complement dynamic interpreted nature of Rebol. It’s still in very early phase but it already has some very nice features (at least I consider them very nice) like fully compiler owned `parse`, finite state machine and (lazy) finite state transducer datatypes.
Oh, and built-in Rebol-like scripting language that can run on (not only) ESP32 called F00.
It’s still work in progress but I like it. Maybe someone else can find it interesting too.
Love that quote. More poetic than my quip “Hope is not a strategy”.
The problem is that you could write those helpers in just about any language, and while Red has an edge over many due to the regular and simple syntax, it's by no means unique in that regard (TCL is an obvious alternative, Lisp-likes are also strong, and even Smalltalk could join the chat if you don't care too much about startup time). And 32-bit-only thing doesn't look good, even if it's not an actual problem in most cases.
In short: it can, but why would you? (Don't get me wrong: I like Red! But with so many other interesting languages (if you're willing to look past TIOBE Top 20), it's hard to justify investing more time into learning Red in particular.)
i found the call documentation. that's a good start, but that is pretty much what every other language also provides. what is still needed is a wrapper that allows me to write
and have that string be populated with the "some" command output. but then we also need to capture stderr and the exit value, so we actually need to capture three return values. next, support for pipes in some form would also be needed.i have worked with lisp and smalltalk and also TCL so i am aware of course.
with so many other interesting languages, it's hard to justify investing more time into learning Red in particular
i actually find red in particular one of the more interesting languages. alongside lisp and smalltalk. haskell, erlang and ocaml are also interesting, but for shell use i am specifically looking at languages that use whitespace as an argument and value separator and which allow complex expressions to be written on one line, since that happens often in shell commands. that reduces the list of interesting languages quite a lot. if you know any others that you think are worth learning, please share.
btw, your website seems to be down.
I tried writing a shell in GNU Smalltalk, but had to mess with the parser - otherwise, the need to parenthesize subexpressions makes it really tedious. I implemented |> as a pseudo-operator that implicitly parenthesized everything before it, which was then removed from the expression. It worked for many simple cases, but wasn't pretty and quickly broke down for more complex ones.
I think the only other language worth investigating in this context is Raku. I avoided it for a long time due to its PERL ancestry, but it's actually a pretty well-designed language, and supports multimethods and overloading of pre-/post-/in- and circumfix operators. The operators support precedence and associativity. If you want an embedded DSL for shell one-liners, I think Raku could deliver. It unfortunately uses the comma for argument separation; you could maybe work around that with quotations and macros, but last I checked, these were experimental and not documented. There was a major effort to move to a better-designed parser that would support AST-based macros, but I'm not sure how far along that is today.
Io would work, though you'd also need to mess with a parser a bit (it's runtime-extensible, though, and also allows circumfix operators and passing unevaluated code as Message objects, which is very helpful in this case). Arguments are normally in parens and comma-separated, but you can simply ignore that. This: `some command --with arguments` is actually a valid Io expression (if `--` is a prefix operator), and since you're not evaluating the code, it doesn't matter if it doesn't make sense semantically. But Io is not very actively maintained (a shame!) It's still a very interesting design. It's described in "Seven Languages in Seven Weeks", if you want a quick intro.
Prolog would probably work, but you'd need to write a metainterpreter - otherwise, threading state in/out of predicates through logic variables would be a nightmare in the CLI. There's also the issue of commas as separators.
You know of TCL, so no need to mention it, though it is a pretty nice fit. A more exotic direction could be concatenative languages: maybe Factor, or Joy, or Kitten. All either experimental or unmaintained, currently. They tend to use whitespace for a separator, and I think they all allow for passing around unevaluated code one way or another.
Looking at the list - Red does look like one of the better candidates, but in normal Red code, all functions know their arity. This means you don't need separators for expressions. It doesn't work that way for shell commands, so you'd probably need to write a Parse grammar, include a separator to allow for variadic commands, and then, after splitting into subcommands, interpret the block command by command. I'm sorry, I'm not too knowledgeable about Red, so I can't give you more details, but that should be the general shape: `shell [ var: cmd1 arg --switch arg2 <some_separator> cmd2 <some_symbol>var ]` where `shell` passes the block to parse, gets a list of commands (including ones that bind results, which would appear as `var_name,command` pair; also, I think path expressions can be used in assignment, so `var/stderr: some command` could be included and handled easily), then walks through the list while setting vars and interpolating them in the following commands. Handling piping wouldn't be much harder than extending the Parse grammar and handling pipelines in the interpreting phase. Finally, you could add refinements on shell for simpler cases (just return exit code, capture all output, etc.) Subshells could be just nested blocks. Thinking about it, it could be a pretty fun way to learn more about Red. Ping me if you end up creating something like that, I'd be very interested to read :)
> btw, your website seems to be down.
I know - I broke my homegrown SSG some time ago and never had the time to fix it :( EDIT: restored some version of the site, 90% of the content still missing.
For an interactive shell, you also need a REPL, which Red provides. So if you write that library for Red, you get the interactive shell for free.
Yes, Red has many advantages: it can AOT compile to native, it's homoiconic, it has a built-in Parse dialect (so the library can be really ergonomic), the Red executable is tiny and starts up fast, it has native GUI capabilities (if you're in a Red-based shell and want to view an image, it's trivial to create a GUI window and display it there). I'm not saying Red would be a bad choice. I'm just not sure it would be my choice, given the existence of, e.g., Chicken Scheme or Smalltalk/X.