Forums > MaxMSP

Max5 – The new "source code" language, usage?

April 23, 2008 | 9:38 pm

So… I’m pretty new to the whole Max/MSP world (well, I’ve been lurking for some years I guess, but I took the plunge only some months ago) – and I’ve been wondering what’s better about the new text-style (copy/paste) source coming out of Max 5 in comparison to the old < 4.6 sources.

How did you Max wizards use the old sources, just for sharing files or did you actually use them to look/read?

Why am I asking? Well, it’s my idea that if anyone was to make a new language today it’d be quite easy to skip out on these old style brackets and what not, especially with a descriptive language such as Max5 (unless I am missing something, it’s a markup language).

To give you a clearer vision of what I am after, I have included a ZIP-file with two text files, one using the new Max5 syntax and one using a more readable syntax that uses indentation instead of brackets and comma-separation (,).

Do I see that the syntax will change in the close future, probably not – but I think that the discussion is quite interesting. With all the nice graphics updating that made Max5 got into the year 2000 – why didn’t the syntax follow?

Best regards,
Fred


April 23, 2008 | 9:45 pm

>With all the nice graphics updating that made Max5 got into the year 2000 – why didn’t the syntax follow?

It did follow. It uses JSON which has become very popular in recent years. Have you heard of "web 2.0" and AJAX and all that mumbo jumbo? A very large portion of that technology uses JSON as the data transfer format. It’s all over the web these days.

You are proposing something like YAML, which is a bit simpler and more readable. YAML is currently gaining in popularity but is not as widespread as JSON and maybe never will be.

Anyway, I’m sure this new JSON format is here to stay for quite a while so get used to it…


April 23, 2008 | 10:00 pm

Quote: Adam Murray wrote on Wed, 23 April 2008 23:45
—————————————————-
> >With all the nice graphics updating that made Max5 got into the year 2000 – why didn’t the syntax follow?
>
> It did follow. It uses JSON which has become very popular in recent years. Have you heard of "web 2.0" and AJAX and all that mumbo jumbo? A very large portion of that technology uses JSON as the data transfer format. It’s all over the web these days.

Yeah sorry, I forgot to mention them two. Just because JSON is more widespread, that doesen’t mean it has to be all good though. And as JSON practically is YAML, except the occasional use of /* */ commenting and a lot of brackets gone missing – why not go for readability instead (YAML)?

> You are proposing something like YAML, which is a bit simpler and more readable. YAML is currently gaining in popularity but is not as widespread as JSON and maybe never will be.

> Anyway, I’m sure this new JSON format is here to stay for quite a while so get used to it…

True true. Still… Was the old syntax only used for sharing purposes or did it have other purposes? If so I see some releveance to keeping this discussion, even though C’74 is not likely to change the syntax in years.

I do realise the enormous amount of work being put into the Max 5 release and I’m not trying to give the people at C’74 a hard time or anything. Just see this as reflection.


April 23, 2008 | 10:28 pm

> why not go for readability instead (YAML)?

I’m guessing it might have something to do with C74 committing to javascript as their scripting language, since JSON and javascript go hand-in-hand.

> True true. Still… Was the old syntax only used for sharing purposes or did it have other purposes? If so I see some releveance to keeping this discussion, even though C’74 is not likely to change the syntax in years.

It’s purpose is just the file format AFAIK.

But by supporting a text format, and updating the older cryptic format to the more structured JSON, it looks like it’ll be easy for people to use the format for other purposes now. Patch generators seems like the obvious thing. Patch Stats (analyzing how deep does the patch go, the most common objects, etc) is another possibility. And coming from a software engineering perspective, I sometimes wonder what patch refactoring tools could be like…

I’m just happy to have a format I can easily process in another programming language. Doesn’t matter so much to me whether it’s XML, or JSON, or YAML, or whatever.


April 23, 2008 | 11:01 pm

i am truly excited to see what kind of patch-generation tools people come up with now that JSON is the maxpat format. it’s the bright side of the no-more-patches-posted-on-list-via-email sadness.

yes, i’m posting this via the forum. workflow change! sigh.


April 23, 2008 | 11:09 pm

These are exactly the kinds of reflections I was going for! Good stuff. I have to load up the Ruby interpreter and try the Json gem out with these files and see what magic can be done.


April 23, 2008 | 11:32 pm

FWIW, JSON is effectively a subset of YAML.

http://en.wikipedia.org/wiki/JSON

IMHO, one of the big reasons brackets or some other mechanism are
preferable to whitespace for data organization, is that there are many
ways that whitespace is munged by email clients, web browsers/forums,
text editors, etc. which can break the format as it is shared between
people. The use of brackets does not suffer from these issues of
whitespace munging, and IMHO, it doesn’t really get in the way. IMHO,
the disadvantages of whitespace based data organization outweigh the
readability argument. Obviously others will disagree.

Really these "human-readable" files, are more for Max or other
software programs to read (PERL, sed, awk, find and replace in files
in your favorite editor). They’re not meant to be books, read by the
fire, or on the toilet;) They are just transparent, whereas the old
format was relatively opaque. It could have been XML, or YAML, or
something else we chose, but we chose JSON. As far as comparison to
XML/YAML, the JSON parsers are typically faster than XML/YAML parsers,
JSON is far less bulky than XML, and many languages have built in
support for JSON reading/writing. There are many good reasons for the
other representations, but it’s not going to change.

People are free to write their own XML< ->(whitespace structuring)YAML< -
>JSON< ->whatever max patch converters, but Max will only read/write
patchers as JSON.

Enjoy your brackets…

-Joshua


Viewing 7 posts - 1 through 7 (of 7 total)