Zomg: You can use JS.

 
Gentleman: Undrinkablesoup: and no variables should be global. that’s a horrible horrible design and you should feel bad for doing it.

Panfil: Global variable shaming?

Dunsworth: Undrinkablesoup, I do l{tab}mdn promise where l is the custom search trigger for feeling lucky search

Gentleman: There should be a tumblr with programmers holding signs like “i made a global variable”

Fallis: GreenJello: awesome! the first code ran. Epic! so very thankful to you. :

Siwik: Undrinkablesoup, does your variable literally needs to be reached from everywhere?

Gallamore: Anyone know of an uber simple module for parsing JS expressions into something that can be toyed with?

Kalkman: RangerMauve: meaning what

Bachinski: Kalkman: Basically, I want something that’d p**** a JS expression and tell me what different parts it contains. Like variable lookups and function calls

Meiggs: My specific use case is for parsing expressions in a template library I’m working on

Botcher: I really just care about variable lookups in the template scope

Ledezma: A basic one. Like, the fewer features it has the better

Standford: I made a request test library!

Standford: Https://github.com/Standford/jort

Standford: It’s just a little tool for single-use mocks of http servers

Reineck: Esprima’s good but it’s pretty complex

Shedrick: Yeah, that’s the thing. It’s like 5.5k SLOC or something crazy like that

Maise: I was thinking of maybe not dealing with actual parsing and figuring out a clever regex or something like that

Gentleman: RangerMauve: JS is a big language. you can’t get a correct and small JS p****r.

Gentleman: RangerMauve: and do NOT use regex.

Mate: RangerMauve: http://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags/1732454#1732454

Reineck: JS is pretty flexible so you can structure things in a ton of different ways

Gentleman: Regular expressions are for regular languages. JS isn’t one.

Reineck: So yeah like Gentleman says it’s not gonna be p****able like that

Gentleman: RangerMauve: just use a correct p****r, no matter how big it is.

Reineck: RangerMauve: why are you so concerned about the size anyway?

Mery: Because I want this to be used client-side

Reineck: You should probably just define your own DSL

Reineck: Something that’s simpler to p****

Gentleman: I really don’t think you do want that.

Gentleman: But if you do, then ship an entire JS p****r to the client.

Sellar: I know for sure that other projects have done that without having to resort to esprima or other full featured p****rs,

Reineck: I don’t think any project is attempting to shove JS into a template language

Reineck: I mean I suppose they could just run it through eval if they do

Scharr: VueJS and Ractive for one

Reineck: If they allow full js syntax then they probably eval it

Gentleman: RangerMauve: “automagically” is another word for “implicit”, which is strictly worse imo

Gentleman: Things should be explicit.

Sturdy: Currently I’m using the Function constructor which is essentially eval without the fancy scope features

Shedlock: Gentleman: Yeah, that’s why I started with my syntax.

Gentleman: Eesh, Function is basically the same as eval

Reineck: Where does vue.js allow full JS syntax btw?

Reineck: Ractive uses Function as well it seems

Reineck: Angular has some sort of expressions which are similar to JS expressions, not sure what they use, but they definitely don’t allow full syntax either

Paulic: Zomg: You can use JS expressions in directives in Vue