On Fri, Apr 21, 2017 at 2:39 PM, James Crate via 4D_Tech < 4d_tech@lists.4d.com> wrote:
> A few more less important things that are in almost every modern language > that would make coding nicer for everyone, and could be added without > affecting legacy code: > +1 on your list. And while The Language Guy (TLG) is around, let's get a few more things done: -- More operators, like ++ and so on. Why not? That won't break old code. -- Short-circuit evaluation of conjoined ifs. I don't think that will break any old code, given how interpretation works now. If it does, a compatibility setting or drop-dead conversion version seems fair. And, since TLG has extra time after doing all of these, METHOD GET PARSE TREE Just give us a navigable parse tree from the specified method. I mean, the 4D interpreter is already building such a thing and so is the compiler. The idea is that you get back a version of the code *that is already fully parsed*. It might have to be XML, as you need nodes to have a type (command, plug-in, method, constant, etc.) and contents (Open Window, etc.) I say a tree because that's what would make sense. A branch for each line and then an interpretation/parse tree for each line. This is handy to have *as 4D sees it* because 4D follows its own rules. For example, I think it does evaluations left-right rather than by order of precedence. The interpreter does this sort of parsing every single day, so it's not like this is a new feature. What's new is exposing the underlying structure to us for reuse. With such a command, we would be free to write whatever code-analysis tools we want. A thousand flowers bloom. P.S. Yes, I know about the token format for METHOD GET CODE. Not what I'm talking about, but glad it exists. The token format doesn't simplify writing a parser, but it does make writing an accurate parser easier. ********************************************************************** 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4d.com/archives.html Options: http://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com **********************************************************************