Cool feature we have just discovered

For questions and postings not covered by the other forums
Stokes
Posts: 66
Joined: Wed Oct 13, 2010 2:06 pm
Location: QLD, Australia

Cool feature we have just discovered

Postby Stokes » Tue Apr 18, 2017 2:59 pm

This is a fun test to run in a workspace. I doubt this is actually a problem for anyone but it does seem strange you can overwrite Classes and Jade Constants within a method.

Code: Select all

constants Object = "Why?"; CrLf = "Not sure"; vars begin write Object; write CrLf; end;

allistar
Posts: 156
Joined: Fri Aug 14, 2009 11:02 am
Location: Mount Maunganui, Tauranga

Re: Cool feature we have just discovered

Postby allistar » Wed Apr 19, 2017 7:42 am

It is odd that Jade allows this. It's to do with scope and is why you can have a local variable with the same name as a member property. I implemented a shift-reduce parser for Jade (in Jade) and this "feature" threw me for a bit. I don't know why anyone would take advantage of it other than to confuse other developers :-)


Return to “General Discussion”

Who is online

Users browsing this forum: No registered users and 7 guests