3 ms·
"Why did s/he have to write it like that? It's cost us untold thousands of hours in coding around their nasty hacks and poor design decisions." However, I recog
by stcredzero 16y ago
"Why did s/he have to write it like that? It's cost us untold thousands of hours in coding around their nasty hacks and poor design decisions." However, I recognize the context they were operating in: they were a tiny startup of about 20 people, trying to organize the world's information.
Yes, but if you're lucky enough to be Google Employee #7, you should now have time to do things like actually do your homework before you post about Lisp.
Just because you're big company coder [single digit] doesn't mean you're necessarily an expert. I actually expect a lot of startup code to be half-baked. Large swathes of the Smalltalk base image code is still egregious, and people have had decades to do something about it and haven't. There were also lots of sophmoric Java API decisions when it first came out.
I don't mistake seniority for expertise, and seniority or friendship with you or anyone in particular doesn't earn anyone a pass with me.
If he knows about but doesn't subscribe to Don't Repeat Yourself then he does a good job of sounding like he just doesn't have a clue and is in the practice of writing lots of boilerplate code. To me, that is a merit of a programming language argument. (In this case demerit.)
Please explain how you can read this post and think the author has a clue about careful name selection? Basically, his major point is predicated on clueless naming in dynamic languages.
- nostrademons 16y agoI've already said I agree with your basic thesis, but here's the tradeoff. Let's leave special forms out of this, on the assumption that any decent Lisp programmer will have them memorized, much like language keywords in other languages. Say that you create a naming scheme for macros - maybe you require that every macro start with "macro-", or you require that they start with "def" and "with-", or whatever. You've now pretty much completely solved the problem Amit points out, that you can't tell whether any given expression will be evaluated or how many times. But you've introduced another tradeoff: verbosity. If you prefix every form with macro-, your code looks a lot like C or JavaScript code that tries to use name prefixes to simulate namespaces, or (shudder) Java code with its AbstractFooBeanBuilderFactoryFactories. And if you use more natural prefixes like def or with-, you limit the flexibility of your macros. Where would aif from On Lisp fit in here? In fact, if you're willing to prefix your names with a unique prefix, you can trivially build a macro system in Python. Here it is: gensym_counter = 0 def gensym(): gensym_counter += 1 return "__gensym%d" % gensym_counter def macro-aif(cond, body): return macroexpand(""" %(gensym)s = %(cond)s if %(gensym)s: it = $(gensym)s %(body)s """ % { 'gensym': gensym(), 'cond': cond, 'body': body) def macroexpand(program): def execute_macro(match): try: return globals()[match.group(1)](*match.groups()[1:]) except KeyError: return match.group(0) return re.sub('(macro-\w+)\((?:(.+?)(?:,\s+|\))\)', execute_macro, program) This doesn't handle the case where macro arguments might themselves contain commas, but that can be done through invoking the Python parser (which is included in the standard library) instead of doing a regexp substitution.