3 ms·
> 1. Create a language to solve your problem; > 2. Solve your problem. But don't we do this in every language, at least if we're doing a good job? I remember
by mpweiher 8y ago
> 1. Create a language to solve your problem;
> 2. Solve your problem.
But don't we do this in every language, at least if we're doing a good job?
I remember the final "exam" of my high school CS class. It was mostly an in-class programming exercise in Pascal.
I was the only one to finish in less than the allotted time. The first one to finish after me did so after the second extension period.
I have to admit while I was obviously inordinately pleased with myself, I was also baffled, because the other people in the class were certainly just as smart as I was.
So what was the difference?
The problem we were given was to draw a bunch of boxes with character graphics with contents and some overlap. Not really hard. Everybody else coded up each box individually with straight code. One after the other. Each time having the handle all the edge cases (literally).
I was the only one who first created a procedure (or set of procedures) for box drawing, and then used those procedures to draw the boxes. And yes, that is very much a simple "language" for solving the problem. Of course the language set some pretty tight limits on how your "language" could look, which is a bane for expression and a boon for understanding.
So I did "define the language, solve the problem in that language". In Pascal. Classic bottom-up programming.
So I dispute that there is a fundamental difference, though there definitely is a significant difference in degree. The difference with high-power languages is that they allow us to apply this much more broadly, whereas with other languages you often run into technical limitations that prevent you from really defining the right language.
With there not being a fundamental difference, I also don't buy that we have a fundamental, unbridgeable divide/chasm/whatever, with these high-power languages with their problems on one side and the "blub" languages with their other problems on the other. Rather, let's explore that regions of the language space and see if we can't narrow the gap.
- gameswithgo 8y agometaprogramming allows more compression of your code than functions alone, sometimes by huge factors
- mpweiher 8y agoYep. I named my company ‘metaobject’ after The Art of Metaobject Protocol. 20 years ago. Metaprogramming is powerful. Can we make it more practical so we can reduce or eliminate the chasm Cees writes about?
- aphextron 8y agoAny resource reccomendations?
- mpweiher 8y agoAlas, not much at this point. My basic starting point is architectural connectors as the basis for "metaprogramming". So bake support for creating and adapting architectural connectors into the language, and then you can do most if not all the things you want with metaprogramming, while at least discouraging the things you don't want. Key is to provide a set of adaptable connectors as a basis, so you guide good meta-design (and reduce its necessity) by providing good examples, rather than enforcing it. Working on a language, tentatively called Objective-Smalltalk: http://objective.st/About/ http://objective.st/About/
- andrekandre 8y agoi’ve actually just bought this book and plan to read it soon, any advice on how to get the most (order of reading, other papers/books to checkout etc) out of it?
- mike_ivanov 8y ago"But don't we do this in every language, at least if we're doing a good job?" There is a difference between expressing higher level abstractions using a language and actually morphing your language in way that you can directly express those abstractions in it. The latter is often impossible, if not because of technical limitations, but rather due to cultural barriers. If it was only once or twice when I worked in a team where stepping off the official language syntax dogma was considered a punishable crime. I've seen things as innocent as "from x import y" (in Python) being discouraged, and even using the dict function instead of {}. People don't generally feel happy about seeing unfamiliar things in what they consider their comfort zone. I don't know what to do about it.
- mpweiher 8y agoBoy is that ever the case! The lengths people will discuss spacing after method declarations, while being completely ignorant of the architectural issues that are rotting their code-base. > comfort zone Tentative essay title: Can Programmers be Liberated from the Gentle Tyranny of Call/Return? > actually morphing your language Yes. And no. First let's have a look at what "morphing the language" means, by way of natural language. When we use natural languages, we can mostly adequately describe anything we want to using the mechanisms available. Sometimes, we need a new vocabulary, sometimes a set of interlocking vocabulary, i.e. jargon. I haven't really seen a case where we need to tinker with the structure of the language, with the grammar. When we add a function, set of functions, interlocking objects/methods etc. I would say that we are also adding vocabulary. And that should be sufficient. The fact that it is not sufficient to me suggests that our fundamental "grammar" (not grammar of the surface syntax) is insufficient, not that we need to be able to make up grammar on the spot every time. Of course making up grammar on the spot also solves the original problem, but it does lead to all these follow-on problems. One being that making up grammar on-the-spot is much more complex than just adding vocabulary, and so you are likely to get it horribly wrong. The other being comprehensibility.