I have a question for our MilkDrop experts: are function names
allowed as variable names or not ? For example, could you write
things like these ?

per_frame=if=above(bass, 0.5)
per_frame=min=min(treb, bass)

In Flickernoise, we currently accept function names as variable
names. This works but weakens the grammar, making it harder or
uglier to extend. If this doesn't break MilkDrop compatibility,
I'd like to disallow variables with the names of functions that
exist in MilkDrop.

This will be particularly useful in the case of "if": I plan to
introduce a Perl-like statement modifier (just for assignments)
that works as follows:

  var = expr if cond

this will be equivalent to

  var = cond ? expr : var

particularly with MIDI controls, this is a very common pattern,
and it looks crowded with the ternary operator. The problem
with the grammar here is that you'd have to parse a fair bit
ahead to tell

  var = expr if cond

from

  var = expr
  if = expr2

Parser generators of the kind we use can't do this, so I'd have
to "manually" disentagle this, which would lead to very messy
code.

For now, I'll just disallow "if" as a variable name if the
patch is written in the new syntax (i.e., when it's either new
code or has already been considerably modified from any
MilkDrop origin).

- Werner
_______________________________________________
http://lists.milkymist.org/listinfo.cgi/devel-milkymist.org
IRC: #milkymist@Freenode

Reply via email to