Skip to content

Instantly share code, notes, and snippets.

@jed
Created April 28, 2010 22:29
Show Gist options
  • Select an option

  • Save jed/382827 to your computer and use it in GitHub Desktop.

Select an option

Save jed/382827 to your computer and use it in GitHub Desktop.
// this is an example of what the first pass at native (fab) templates will look like:
with ( require( "fab" ) ) fab
( listen, 0xFAB )
( /\// )
( /1/ )
( "This is a template with no variables: a unary app" )
( /2/ )
( "This is a template with {{1}} variable: a binary app." )
( "one" )
( /3/ )
( "This is a template with {{1}} variables: a {{2}} app." )
( "two" )
( "ternary" )
( /4/ )
( "You can even {{1}} them!" )
( "{{1}} and {{2}}" )
( "mix" )
( "match" )
( "Any feedback appreciated: http://twitter.com/{{1}}" )
( "jedschmidt" )
( 404 );
@jed

jed commented Apr 29, 2010

Copy link
Copy Markdown
Author

maybe i should make a t-shirt:

i'm with (isaacs)

@isaacs

isaacs commented Apr 29, 2010

Copy link
Copy Markdown

I don't think that making functions slow will be enough to convince people not to use it. They'll just decide that (fab) is slow, and whine about it.

That shirt idea is AWESOME.

@jed

jed commented Apr 29, 2010

Copy link
Copy Markdown
Author

it's possible, but the good news is that like most overly-indented code, writing inline functions in (fab) gets awkward really fast. hopefully that'll be enough of a deterrent.

with ( isaacs ) i.am(); is probably better tho.

@isaacs

isaacs commented Apr 29, 2010

Copy link
Copy Markdown

hmm...

Wouldn't that shirt just say that I'm with myself?

Which I guess is true...

@subtleGradient

Copy link
Copy Markdown

This looks like BS to me. BuildSugar that is. My crazy template experiment.
I'm still not exactly sure if this code style is horrifying or fabulous.

Code: https://gist.github.com/278016/5f3ad4785929905871c4d87826c32bd3f8cff064#file_build_sugar.usage.js
Demo: http://www.jsfiddle.net/c3nxS/1/

@tlrobinson

Copy link
Copy Markdown

What if you want a template with more than 2 variables?

@jed

jed commented May 4, 2010

Copy link
Copy Markdown
Author

the template app actually creates an n-ary app, where n = the highest variable number + 1.

@felixge

felixge commented May 7, 2010

Copy link
Copy Markdown

I'm with (isaacs) too: No with please!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment