News for hackers. Stuff that matters.
Re:racket/rhombus: "We're now officially in the "integration... by soegaard on Sunday August 04, 2024 @03:34PM (#41155756)
The idea behind macros is so to speak to allow the programmer to extend the compiler.

In a language like MetaPost I can use equations between variables:

   x + y = 10
   x - y =  6
A reference to a variable x will use the current set of equations and solve for x. The solution (it it exists) will become the value of the variable reference.

Let's say I want to extend Rhombus with this new kind of variable (let's call them linear variables).

Each linear variable needs to have some static information attached. Here the relevant information is the set of equations to consider. A reference to a linear variable will then reduce (at compile time) the equations associated with the variable. The reduced set of equations is then used to generate runtime code that finds the value.

In a sense "static information attached to an expression" is just a convenient way of working with compile time information (in the sense currently used by macros in Racket).

Re:racket/rhombus: "We're now officially in the "integration... by scotty79 on Sunday August 04, 2024 @09:16PM (#41157444)
Is that the reason for two different type annotation signifiers? That some day I might want to extend the language with something?

It sounds a bit like if every C function (including hello world) had to have empty asm block because someone might need it some day.

Re:racket/rhombus: "We're now officially in the "integration... by soegaard on Monday August 05, 2024 @04:16AM (#41159106)
The operator `expr :~ annot` simply attaches the static information to the expression.

The operator `expr :: annot` will at runtime insert a check that the expression satisfies the annotation.

Re:racket/rhombus: "We're now officially in the "integration... by scotty79 on Monday August 05, 2024 @11:15AM (#41162137)
What if I want both behaviors at the same time? Have some static information attached and also do a runtime check?