Live data from Hacker News

XL: An Extensible Programming Language

xlr.sourceforge.io

31–40 of 87 posts

Re: XL: An Extensible Programming Language

#31

I would really like to see more discussions about the difficulties using LLVM can create for smaller language projects. The entire PL ecosystem is hyped up to revolve around the project, but rarely do you see language designers and solo/small group devs talk specifically about problems relying on LLVM. The history section of XL’s page cites non-commitment to code compatibility between releases as their big struggle,…

I specifically addressed some of these topics in this talk: https://www.youtube.com/watch?v=Xzo7GIoDgAo

Re: XL: An Extensible Programming Language

#32
post #29

Author of the project here... Weird to see this generates such a discussion when the project is something like 20 years old, and has been quasi-dead for a while now ;-) An interesting derivative of XL is Tao3D, which shows what you can do with it. https://tao3d.sourceforge.net A FOSDEM workshop about Tao3D (which includes initiation to XL): https://www.youtube.com/watch?v=uE9LwSuZD64 The design philosophy, and why it…

How does this compare to http://flexipl.info/

Iirc backend and goals seem quite similar.

Re: XL: An Extensible Programming Language

#33
Anyone know of other languages using pattern matching as a foundation?

I’ve come across Refal[1], who’s creator Valentin Turchin seems like someone who hasn’t gotten the recognition he maybe deserves. As an aside, his son Peter Turchin does some interesting work in a different direction that’s def topical these days.

I know SNOBOL gets labeled as one.

Would Prolog count? I haven’t actually written any myself. They def make a strong appearance in Erlang, though it isn’t the first thing that comes to mind if describing. There’s XSLT of course.

Any others?

I think if one were only able to pick one metaphor for a language, I think a strong case could be made for:

pattern => behavior

[1]https://en.wikipedia.org/wiki/Refal

Re: XL: An Extensible Programming Language

#34
post #7

Those interested in XL may also find the much older GalaxC by John Beetem interesting: https://community.element14.com/technologies/fpga-group/b/bl...

Why do you think it's older? XL started as LX around 1993, and IIRC self-compiled in 2004 or so.

Re: XL: An Extensible Programming Language

#35
post #14

Earlier quoted context omitted.

> There are lisps without parens too Are there any that come close to the usage of lisps with proper s-expressions? I've seen them come and go, but no "lisp without parens" that seem to stick around for longer period. I guess that should say something? Maybe we just haven't found the right way of exposing it though. Personally, when I've given it a try, the indentation-based syntax always makes it hard to use without…

I am pretty sure logo is mostly a lisp without parenthesis. I find it a lot more readable than most lisp dialects. I am not sure why it never caught on.

It is. A piece of trivia: AFAIR, you say

  SUM 2 3
in Logo to add two numbers, but

  [SUM 2 3 4]
to add more. (Though I learned Logo more than three decades ago, so I might be mistaken.)

Re: XL: An Extensible Programming Language

#36

Obligatory "lisp has had this for ages". Herein, macros seem to be invented from first principles, having only been exposed to imperative languages like C++. It is interesting to see macros here invented in the context of a language that is not homoiconic. I wonder how it stacks up against Rust macros.

See the code around here to answer that question:

Definition of 'if' statement: https://github.com/c3d/xl/blob/fast/src/builtins.xl#L155

  // If-then-else statement
  if [[true]]  then True else False   is True
  if [[false]] then True else False   is False

  if [[true]]  then True              is True
  if [[false]] then True              is false
Definition of loops (https://github.com/c3d/xl/blob/fast/src/builtins.xl#L222)

  // Loops
  while Condition loop Body is
      if Condition then
          Body
          while Condition loop Body
  until Condition loop Body               is { while not   Condition loop Body }
  loop Body                               is { Body; loop Body }
  for Var in Low..High loop Body is
      Var := Low
      while Var 

Re: XL: An Extensible Programming Language

#37
post #17

Seems cool. But I'm not convinced extensible languages benefit from adding a variety of syntactic forms. As your ability to extend the feature-set increases, the need for a single regular syntactic form increases. Lisp may not be appealing to beginners because of its parenthesis, but they absolutely are what makes it work so well for its intended use cases. Really, all use cases. I'm actually a fan of the parenthesis…

IMO, there’s a wide unexplored design space between the minimalism of Lisp and richness of other languages. A programming language inspired by something like KDL ( https://github.com/kdl-org/kdl ) has the potential to be in a very sweet spot between the two. "Everything is a node" instead of "everything is a list" is only slightly more complicated, but also vastly more readable that a soup of parenthesis.

Where would you put Lua on this spectrum?

Also, I do not find Lisp unreadable - you train your brain to ignore the parens and look at the indentation instead pretty quickly. And you can always tell Emacs to gray out the parens if you really want. ;-)

Re: XL: An Extensible Programming Language

#38
post #12
post #9

Earlier quoted context omitted.

I don't see them as macros either, it's more like pattern matching and replacing patterns with expressions. Maybe there is a term for that? And it's not compile-time only, I'm pretty sure you can't do this as a macro: >loop Body is { Body; loop Body }

> it's more like pattern matching and replacing patterns with expressions Scheme macros use pattern-matching. > loop Body is { Body; loop Body } This, though, is definitely strange. I’m not quite sure how it works.

You can do exactly that, and this is how this is defined in the built-in library

https://github.com/c3d/xl/blob/fast/src/builtins.xl#L222

How it works is what I tried to document in the document above. The trick is to have some fixed semantics on how rewrites are done, but a lot of freedom in how this is implemented. And this is far from perfect ATM.

For example, if you write "X is 2", this can be implemented as a constant, as a function returning a constant, or as a macro. However, if you write "X is seconds" in Tao3D, where "seconds" returns the current number of seconds in the clock, then it can no longer be a constant value. You still can use macro replacement (or inlining) or turn it into a function.

More details here: https://xlr.sourceforge.io/#compiling-xl

Re: XL: An Extensible Programming Language

#39
post #34
post #7

Those interested in XL may also find the much older GalaxC by John Beetem interesting: https://community.element14.com/technologies/fpga-group/b/bl...

Why do you think it's older? XL started as LX around 1993, and IIRC self-compiled in 2004 or so.

I am looking at a 1989 paper by Beetem & Beetem [1] but then it was called Galaxy.. I agree "much older" might be a bit.. much. Haha.

EDIT: Joking aside, I would love to hear a compare & contrast between Galaxy/GalaxC & LX/XL, though!!

EDIT2: and via that first link, I think you can get to a full source code distribution compile-able with C on 32-bit Linux. Might have its own woes like LLVM hosting, but those might also be more solvable as part of a 64-bit port.

[1] https://ieeexplore.ieee.org/abstract/document/28124/

Re: XL: An Extensible Programming Language

#40

What does "is is is" mean in this language? Maybe it's a quine? Can you define an "isn't" operator?

Let's ask the interpreter / compiler:

  ./xl -nobuiltins -parse /tmp/glop.xl -style debug -show
  (infix is
   is
   is
  )
So what it sees is a definition of a name 'is' as itself.

Now, that name is very unlikely to be usable because `is` as an infix is so central to everything. As a matter of fact, it looks like even "is is 2" actually crashes the current implementation.

Oh well. I wonder what a sensible error message on this would be. Probably: "Bill Clinton denied to comment on the meaning of that statement".

Post reply on HN