3 ms·
I really don't think that this is bad advice in general. Mess with the code all you want at compile time, but don't touch it at runtime is the good kind of bori
by Spivak 6y ago
I really don't think that this is bad advice in general. Mess with the code all you want at compile time, but don't touch it at runtime is the good kind of boring. CL is an extremely powerful language, it doesn't mean you should be using it all the time in your day-to-day work.
- avmich 6y ago> CL is an extremely powerful language, it doesn't mean you should be using it all the time in your day-to-day work. That's the problem of code guides - they try to avoid problems with some abuses, but to make a good judgement when some rare decision is justified is hard. So the guide misses the mark by making an approximate limitation - often on the safe side. It has benefits to write on boring, safe subsets of languages. Still writing code guidelines is hard.
- kazinator 6y agoThe thing is, you usually shouldn't be calling INTERN even at compile time. A better rule is this: Don't use code to calculate character strings, which are then converted to symbols via INTERN. The main exceptions to this rule are structs (which generate slot-reader functions by combining the structure name and slot names). Macrology which calculates names using code, which are then supposed to be explicitly referenced in code, is pretty stinky. E.g.: (define-blob foo ...) Here, you're suposed to Just Know that the above is referenced as blob-foo and not foo, because internally it catenates "BLOB-" onto (symbol-name 'foo), and calls intern on that.
- Spivak 6y agoI feel like there needs to be a refinement that allows for something like (define-blob foo) to produce the symbol FOO but no other symbols.
- dreamcompiler 6y agoAbove is one of the many reasons I prefer defclass to defstruct. Defclass doesn't do this ridiculous nonsense.
- tgbugs 6y agoMany times when working with code that uses structs in Racket I have found myself fruitlessly grepping for the definition of some mysterious and troublesome function before eventually remembering to check whether there is a struct named foo with a member named bar somewhere. Normally this is not a problem so long as the file can make it far enough through the syntax phase that you can resolve the names. Yet somehow when the code is well and truly broken then somewhere, somehow, a struct will be involved without any way to resolve the member name. I say this having written my own symbol creating and binding macros before I realized the pitfalls and now dread having to go back and fix it. It seems like such a cool idea in principle.
- dreamcompiler 6y agoIt's a cool idea for programming and a terrible idea for software engineering.