[erlang-questions] ANNOUNCE: adapter_pattern for mochiweb/cowboy/misult and scripting language

Richard O'Keefe <>
Mon Feb 20 02:19:40 CET 2012


Joe Armstrong is, in my pantheon, an OED sense 1 hero
http://www.oed.com/view/Entry/86297?rskey=8Hch8X&result=1#eid

However, there are times when I strongly disagree with him,
and on this occasion at least, it's _because_ he's a sense 1
hero and I'm *not*.

On 18/02/2012, at 3:31 AM, Joe Armstrong wrote:

> I also threw in a web scripting language called EHE. EHE is "Html with
> embedded Erlang"
> 
> So  <?e Name = "joe" ?> has <?e integer_to_list(Name) ?> characters

FUNDAMENTAL LAW NUMBER ONE.

	I make mistakes.  Lots of mistakes.  Lots of stupid little
	mistakes.  Not so many type errors, but more than enough
	typing errors.

	I need help.

FUNDAMENTAL LAW NUMBER TWO.

	Strings don't nest.

	It didn't have to be that way.  Lisp embeds Lispy mini-languages
	with the greatest of ease, but Lisp is fully bracketed.  Algol
	60 strings had distinct left and right quotation marks, so they
	_did_ nest.  Just try to find an "Algol 60" compiler that
	supported them!  If you use straight-up-and-down quotation marks
	like Fortran and Smalltalk '...' or C or Java "...", they just do
	not nest.  HTML uses '...' and "..." in some contexts and
	<![CDATA[...]]> and <!-- ... --> and <? ...> (in XHTML, <? ... ?>)
	in others.

	They don't nest.

STRING COROLLARY TO MURPHY'S LAW.

	What *can* go wrong in a language embedded in HTML syntax *will*
	go wrong.  Often.  Embarrassingly.

EMPIRICAL LAW NUMBER THREE.

	None of the HTML or XML editing, checking, or validation tools available to
	me knows anything about Erlang syntax, at least not when processing HTML
	or XML, and similarly,
	none of the Erlang editing, checking, or validation tools available to me
	knows anything about HTML or XML, at least not when processing Erlang.

DIABOLIC COROLLARY.

	With the embedded approach tool help is least available to me
	when I need it most.

The diabolic corollary does *not* apply to embedding languages with *compatible*
lexical/syntactic structures.  A few years ago I generated a fair bit of XML
using a Scheme toolkit I called SXS (Simple XML in Scheme, pronounced "success",
and for me it _was_ a success).  However, the XML was written using Schemely
syntax.

The "native HTML" way to do it would be to write an HTML page using any HTML
editor you like, attach hook points to it using 'class' and 'id', use
<script> to attach file-specific code, and give it to process that parses
it, applies the transforms loaded by the <script>, and emits plain HTML.

Of course, if Joe is planning to offer a tool that validates *both* the HTML
(HTML5?) page *and* the embedded Erlang code, that's a completely different story.





More information about the erlang-questions mailing list