dghosef / qdbp

MIT License
51 stars 1 forks source link

Easier syntax for methods that just return a capture #9

Closed qdbplang closed 1 year ago

qdbplang commented 1 year ago

A very common pattern in qdbp is:

value := expr
{
  Method[value]
}

i.e. evaluate an expression, save it into a variable, and then capture that variable and return it. It would be nice if we had some syntactic sugar for the pattern. Potentially something like

{
  Method := expr
}
qdbplang commented 1 year ago

Since . is used do indicate "evaluate this method right now," maybe we could have

object := {
  Method[body]
  Field[value].
}

Note the period after Field, indicating "we want to evaluate Field right now.