Live data from Hacker News

Red programming language 0.6.2: LibRed and Macros

red-lang.org

31–40 of 86 posts

Re: Red programming language 0.6.2: LibRed and Macros

#31

I know a lot of you may like case insensitive languages, but it just feels weird for me. And there is the "nim" language which makes no distinction between CamelCase and snake_case.

At least it doesn't force any casing on you, as some languages do.

Another thing to get used to is the ability to include characters in names that you normally can't, e.g., - and ?.

Re: Red programming language 0.6.2: LibRed and Macros

#32
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.

What does a type being built-in do for you extra? In ES6 you can define a template string builder which you could name, for instance, ipv4, and then when you want an IPv4 address literal you say ipv4`192.168.0.1` and get your object. Are there other benefits besides a literal syntax? (Not to slag on Red. One advantage I can see is avoiding the call at runtime to the ipv4 function.)

I'll add to my reply, because this is a really good question.

Red doesn't have all types in place yet (e.g. date! is coming, and maybe an @ref type, among others), but can still load the following:

  at 10:00 send gregg@host.dom a link to http://red-lang.org (216.239.32.21)
  delete %/c/temp/junk.dat
  assign #DECAFBAD-7337 to John
  make the main window 800x600 with a color of 255.0.0
  answer: yes
Here's a quick console session showing what types it found:

  >> blk: [  at 10:00 send gregg@host.dom a link to http://red-lang.org (216.239.32.21)
  [      delete %/c/temp/junk.dat
  [      assign #DECAFBAD-7337 to John
  [      make the main window 800x600 with a color of 255.0.0
  [      answer: yes
  [    ]
  == [at 10:00:00 send gregg@host.dom a link to http://red-lang.org (216.239.32.21) 
      delete %/c/temp/junk.dat 

  >> unique collect [foreach val blk [keep type? val]]
  == [word! time! email! url! paren! file! issue! pair! tuple! set-word!]
And you can parse at that level:

  >> parse blk [
  [        some [
  [            'window set val pair! (print ["size:" val])
  [            | 'assign set val issue! (print ["issue:" val])
  [            | 'link 'to set val url! (print ["link:" val])
  [            | skip
  [        ]
  [    ]

  link: http://red-lang.org
  issue: DECAFBAD-7337
  size: 800x600
Of course, you could do something similar in ES6. If you use template literals, your data might look like this:

  at time`10:00` send email`gregg@host.dom` a link to url`http://red-lang.org` paren`(ipv4`216.239.32.21`)`
  delete file`%/c/temp/junk.dat`
  assign issue`#DECAFBAD-7337` to John
  make the main window pair`800x600` with a color of color`255.0.0`
  name`answer:` bool`yes`
Sorry for getting carried away. :)

Re: Red programming language 0.6.2: LibRed and Macros

#33
post #7

Earlier quoted context omitted.

REBOL was first built by Carl Sassenrath, who is probably best known for his work on the Amiga operating system. REBOL was cool, but happened when a half dozen similarly cool languages sprung up that also had the feature of being free and open source (while REBOL was proprietary and cost a little money). REBOL had some novel ideas, and some shortcuts for some particular types of development making for strikingly conc…

Please give Red a look. It can run like Python or can be made compiled AOT to a tiny binary using a C like systems language that runs fast. You can call Red from C and possibly vice-versa (not sure bout the latter). It has an awesome REPL, amazing GUI DSL, is homoiconic like lisp for easy macros, and is OS/free. I'm not sure where this couldn't be used as it can be both super high level or very low level.

Ill add they have Red/System for low-level. Some kernel or server coders should try putting some code through it to see how it does.

Re: Red programming language 0.6.2: LibRed and Macros

#34

Earlier quoted context omitted.

Please give Red a look. It can run like Python or can be made compiled AOT to a tiny binary using a C like systems language that runs fast. You can call Red from C and possibly vice-versa (not sure bout the latter). It has an awesome REPL, amazing GUI DSL, is homoiconic like lisp for easy macros, and is OS/free. I'm not sure where this couldn't be used as it can be both super high level or very low level.

Ill add they have Red/System for low-level. Some kernel or server coders should try putting some code through it to see how it does.

Fair enough, even if it is great, it won't have 30 years of optimizations like some C compilers, but hopefully it is still really fast.

Re: Red programming language 0.6.2: LibRed and Macros

#36

Earlier quoted context omitted.

What does a type being built-in do for you extra? In ES6 you can define a template string builder which you could name, for instance, ipv4, and then when you want an IPv4 address literal you say ipv4`192.168.0.1` and get your object. Are there other benefits besides a literal syntax? (Not to slag on Red. One advantage I can see is avoiding the call at runtime to the ipv4 function.)

I'll add to my reply, because this is a really good question. Red doesn't have all types in place yet (e.g. date! is coming, and maybe an @ref type, among others), but can still load the following: at 10:00 send gregg@host.dom a link to http://red-lang.org (216.239.32.21) delete %/c/temp/junk.dat assign #DECAFBAD-7337 to John make the main window 800x600 with a color of 255.0.0 answer: yes Here's a quick console sess…

That does look handy! I guess there must be a tradeoff in having your text default to meaning plain words if you mess up the syntax? Versus hopefully getting an error in the ES6 case.

Re: Red programming language 0.6.2: LibRed and Macros

#37

Earlier quoted context omitted.

Ill add they have Red/System for low-level. Some kernel or server coders should try putting some code through it to see how it does.

Fair enough, even if it is great, it won't have 30 years of optimizations like some C compilers, but hopefully it is still really fast.

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.

Re: Red programming language 0.6.2: LibRed and Macros

#38

Earlier quoted context omitted.

I'll add to my reply, because this is a really good question. Red doesn't have all types in place yet (e.g. date! is coming, and maybe an @ref type, among others), but can still load the following: at 10:00 send gregg@host.dom a link to http://red-lang.org (216.239.32.21) delete %/c/temp/junk.dat assign #DECAFBAD-7337 to John make the main window 800x600 with a color of 255.0.0 answer: yes Here's a quick console sess…

That does look handy! I guess there must be a tradeoff in having your text default to meaning plain words if you mess up the syntax? Versus hopefully getting an error in the ES6 case.

You can always get errors of course. The new `load/trap` feature gives you more flexibility in that area, but there are limits as with anything. Pretty handy for CLIs, though, when you expect your audience to know what "syntax" even means. :)

Re: Red programming language 0.6.2: LibRed and Macros

#39
post #24
post #21

Earlier quoted context omitted.

I read their about page and their newest post. It was a lot to take in. It was concerning that all the screening had that windows look and feel. I am kind of excited to try something so large in scope and so different, but no Linux support would kill it before I even downloaded it.

Linux support is just the beginning. Soon you'll be able to compile for iOS, Android and other platforms.

Yea, using a simple switch to compile tiny native executables for a ton of platforms is a huge draw. Not having to walk a non-coworker through a python install who doesn't want python on their computer will be nice.

Re: Red programming language 0.6.2: LibRed and Macros

#40

Earlier quoted context omitted.

Fair enough, even if it is great, it won't have 30 years of optimizations like some C compilers, but hopefully it is still really fast.

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 (note that I don't mean that negatively...I'm very impressed with the Red community, I just want to have my 1929 Latour with my Kobe beef riding in my personal spaceship alright ;) ). Forgive me.
Post reply on HN