Live data from Hacker News

Red programming language 0.6.2: LibRed and Macros

red-lang.org

41–50 of 86 posts

Re: Red programming language 0.6.2: LibRed and Macros

#41
post #4

I've never seen a language with such a variety of built-in data types (e.g. coordinates, tags, email, url, issues). There's support for IPv4 numbers as a base type (tuples) but I can't tell if there's support for IPv6, which shows the trouble with this approach for the language maintainers.

The tuple! type supports 3-12 segments, but only 0-255 in each segment, which is a byte. So it's used for colors, IPv4, and can be stretched for custom purposes. IPv6 doesn't have a literal form, though it's been discussed. One of the problems is that lexical space is tight and supporting it specifically may lead to ambiguity with time! values. Also, the colon is an important delimiting character, which makes having…

>the colon is an important delimiting character, which makes having hex coded value ambiguous as well

In IPv6 or in Red, you mean?

In IPv6 the colons are there for convenience only, with the rule being that leading zeros can be omitted and that two or more consecutive groups of all zeros can be replaced with ::. You can only have one instance of :: otherwise it would be ambiguous.

For example, the IPv6 address ::1 is actually 0000:0000:0000:0000:0000:0000:0000:0001.

Likewise, 2a03:2880:fffe:c:face:b00c:0:35 is actually 2a03:2880:fffe:000c:face:b00c:0000:0035.

Once an IPv6 address has been expanded to it's full non-abbreviated form you can safely strip it of colons and use the resulting hexadecimal value to uniquely represent that address.

If you were talking about colons in Red and not in IPv6, disregard what I said.

Re: Red programming language 0.6.2: LibRed and Macros

#42

Earlier quoted context omitted.

The compiler doesn't optimize at all right now, but aims for simplicity. There was an article some time back about the best switches to use for most C compilers: compile for size. It often gave some of the best performance IIRC, the rationale being better cache use on chips.

When will it optimize, or will it? I'd like to see some benchmarks on the main page for a couple of algorithms like Fibbonaci in both Red & Red System compared to a popular scripting language like Python and a popular office language like Java. I would hope Red is close to Python in speed and Red System to Java. Obviously it won't be yet, but performance is important and if it isn't a priority, I'll look elsewhere (n…

As you know, benchmarks are often fun but just as often meaningless. And premature optimization being the root of...anyway. ;)

It may come. JIT is planned. I don't know of any language that wants to be slow, and I can only speak for myself, but I think Red's goal is one of overall performance. In 1991, people told me I couldn't use VB, because it was too slow. I countered that my app would be 12-18 weeks faster than their C app. :) Still, this is 2017 and we have options.

Red won't be fast enough for everyone, or everything. But it will be faster than a lot of alternatives for many purposes. What kind of stuff do you need maximum performance for, how much of your work is that, and what are some of your real-world examples and performance criteria? I work best with concrete examples.

Re: Red programming language 0.6.2: LibRed and Macros

#43

Earlier quoted context omitted.

The tuple! type supports 3-12 segments, but only 0-255 in each segment, which is a byte. So it's used for colors, IPv4, and can be stretched for custom purposes. IPv6 doesn't have a literal form, though it's been discussed. One of the problems is that lexical space is tight and supporting it specifically may lead to ambiguity with time! values. Also, the colon is an important delimiting character, which makes having…

>the colon is an important delimiting character, which makes having hex coded value ambiguous as well In IPv6 or in Red, you mean? In IPv6 the colons are there for convenience only, with the rule being that leading zeros can be omitted and that two or more consecutive groups of all zeros can be replaced with ::. You can only have one instance of :: otherwise it would be ambiguous. For example, the IPv6 address ::1 is…

I meant if we try to add a literal ipv6 form to Red, but thanks for the info!

Re: Red programming language 0.6.2: LibRed and Macros

#44
This is definitely a neat release. Red seems to be coming along great, and am interested in what a 1.0 release might look like. Checking their "Roadmap" they have some very interesting (great?) goals. They seem to be heading towards a sort-of "runtime purity" by (at least aiming for) targeting:

    - Native (bridging to Obj-C)
    - JVM
    - CLR
While also supporting shared objects so my assumption is that dynamically linking is possible.

On top of this it looks like they want to support a sort-of wxWidgets-like GUI programming (which I personally believe to be the correct approach to GUI abstractions). Backends they aim to support:

    - Windows (done)
    - GTK+
    - macOS
    - iOS
    - Android
This reminds me of the approach a lot of JVM focused languages are taking like Clojure that support the CLR, JVM, Node and Web Browser.

I guess the obvious questions to ask would be:

1. Any reason for not wanting to target WebAssembly/JavaScript (and in conjunction node.js [I understand that this isn't trivial])?

2. Any reason targeting QT isn't on the roadmap? [targets for KDE, Sailfish, ect..]

3. Any reason wxWidgets wasn't a great choice as a foundation? (I believe they have a C API last I looked)

4. Is there or will there be an API for creating custom languages that can target/leverage Red's infrastructure? (basically a Red version/wrapper for flex/bison)

Finally, adding support for Erlang nodes should be fairly trivial if it was a wrapper to the C Node API, but it could also be implemented via a pure Red implementation.

tl;dr I'm interested to see how Red will evolve further not necessarily because the syntax intrigues me, but because of the goals the team have set for themselves as far as polymorphic runtimes go.

EDIT: formatting

Re: Red programming language 0.6.2: LibRed and Macros

#46

Earlier quoted context omitted.

The compiler doesn't optimize at all right now, but aims for simplicity. There was an article some time back about the best switches to use for most C compilers: compile for size. It often gave some of the best performance IIRC, the rationale being better cache use on chips.

When will it optimize, or will it? I'd like to see some benchmarks on the main page for a couple of algorithms like Fibbonaci in both Red & Red System compared to a popular scripting language like Python and a popular office language like Java. I would hope Red is close to Python in speed and Red System to Java. Obviously it won't be yet, but performance is important and if it isn't a priority, I'll look elsewhere (n…

You're focing a lot on just one point. Many people will sacrifice ultra-optimization or even optimization itself for productivity and flexibility. There's whole industries dedicated to it.

A cheat, though, would be extracting lowest-level form to C to leverage their compilers. Lots of languages did that.

Re: Red programming language 0.6.2: LibRed and Macros

#47

Earlier quoted context omitted.

The compiler doesn't optimize at all right now, but aims for simplicity. There was an article some time back about the best switches to use for most C compilers: compile for size. It often gave some of the best performance IIRC, the rationale being better cache use on chips.

When will it optimize, or will it? I'd like to see some benchmarks on the main page for a couple of algorithms like Fibbonaci in both Red & Red System compared to a popular scripting language like Python and a popular office language like Java. I would hope Red is close to Python in speed and Red System to Java. Obviously it won't be yet, but performance is important and if it isn't a priority, I'll look elsewhere (n…

Per Nick's comment, above, Red likely won't generate C, because that would add a dependency on a C toolchain. Red is completely self-contained, and would like to stay that way. However, you could write those tight bits in C and put them in a DLL or something, to call from Red.

Re: Red programming language 0.6.2: LibRed and Macros

#48
post #44

This is definitely a neat release. Red seems to be coming along great, and am interested in what a 1.0 release might look like. Checking their "Roadmap" they have some very interesting (great?) goals. They seem to be heading towards a sort-of "runtime purity" by (at least aiming for) targeting: - Native (bridging to Obj-C) - JVM - CLR While also supporting shared objects so my assumption is that dynamically linking i…

> 1. Any reason for not wanting to target WebAssembly/JavaScript (and in conjunction node.js [I understand that this isn't trivial])?

Wasm will likely be the browser target.

> 2. Any reason targeting QT isn't on the roadmap? [targets for KDE, Sailfish, ect..]

They wanted to go native to start. QT is GPL licensed. Not a good fit for Red. Their "small" installer, which downloads the big stuff, is 18M. Red, with self-contained toolchain and cross compiler + GUI, is 1MB.

> 3. Any reason wxWidgets wasn't a great choice as a foundation? (I believe they have a C API last I looked)

Targeted at C++, and also very large.

> 4. Is there or will there be an API for creating custom languages that can target/leverage Red's infrastructure? (basically a Red version/wrapper for flex/bison)

You can use libRed, which makes Red available as a DLL you can call into from other langs, like C. See http://www.red-lang.org/ where a couple GIFs show integration with VBA and Excel even.

Ultimately, the decision not to use something comes from value added and available resources. Team Red is small, and has to pick their battles carefully.

Re: Red programming language 0.6.2: LibRed and Macros

#49

Earlier quoted context omitted.

When will it optimize, or will it? I'd like to see some benchmarks on the main page for a couple of algorithms like Fibbonaci in both Red & Red System compared to a popular scripting language like Python and a popular office language like Java. I would hope Red is close to Python in speed and Red System to Java. Obviously it won't be yet, but performance is important and if it isn't a priority, I'll look elsewhere (n…

As you know, benchmarks are often fun but just as often meaningless. And premature optimization being the root of...anyway. ;) It may come. JIT is planned. I don't know of any language that wants to be slow, and I can only speak for myself, but I think Red's goal is one of overall performance. In 1991, people told me I couldn't use VB, because it was too slow. I countered that my app would be 12-18 weeks faster than…

One of the things that initially excited me was being able to write code like Python for parsing and automating office tasks and then dropping down to RedSystem for numerical work like matrices and various algorithms and perhaps some embedded work like talking to an arduino. If it could truly do that, I'd give up needing to know 9 languages depending on what I'm doing.

Re: Red programming language 0.6.2: LibRed and Macros

#50

Earlier quoted context omitted.

As you know, benchmarks are often fun but just as often meaningless. And premature optimization being the root of...anyway. ;) It may come. JIT is planned. I don't know of any language that wants to be slow, and I can only speak for myself, but I think Red's goal is one of overall performance. In 1991, people told me I couldn't use VB, because it was too slow. I countered that my app would be 12-18 weeks faster than…

One of the things that initially excited me was being able to write code like Python for parsing and automating office tasks and then dropping down to RedSystem for numerical work like matrices and various algorithms and perhaps some embedded work like talking to an arduino. If it could truly do that, I'd give up needing to know 9 languages depending on what I'm doing.

That is exactly its goal.
Post reply on HN