The search for the natural language
Jeremy Miller is looking for a DSL that reads like natural language. My immediate response was that it is not practical, because I assumed he wanted very natural language, which is still not possible to do without extremely high budget. Limiting the problem to just reads like a natural language reduce the problem space significantly.
I am going to have a separate post about how to actually solve such a problem, but for now, I want to talk about the actual requested solution. I think it is 100%solvable with a low cost approach. That is, you can get a DSL that reads like English in under an hour. But I don't think it is valuable.
English is a terrible language to express instructions in. Any natural language is terrible in expressing instructions, just find the nearest army sergeant, they will tell you that.
Let us take a look at a language that actually took this approach:
tell application "Finder"
set the percent_free to ¬ (((the free space of the startup disk) / (the capacity of the startup disk)) * 100) div 1
end tell
if the percent_free is less than 10 then tell application (path to frontmost application as text)
display dialog "The startup disk has only " & the percent_free & ¬
" percent of its capacity available." & return & return & ¬ "Should this script continue?" with icon 1 end tell
end if
This is apple script. From my point of view, this is horrible. It is unreadable in the extreme. More than that, trying to explain how this language works, or how it handles error is a non trivial task.
This has been my experience any time I actually tried to create a natural language like syntax. It is too complex, and users get annoyed when they can't use real natural language.
From my perspective, getting an expressive DSL does not means that it has to read like an English statement. In fact, it probably shouldn't. Too much noise involved. A structured approach isn't just to help the compiler, but to help the reader.
Comments
Time to start keeping track of all the things you can do in "under an hour". Then I can try and hire you to do them all for me in one day ;)
Actually, I'll let Google keep track http://tinyurl.com/5s8wk4
I agree with that.
And in my opinion, there is a psychological side of things. If the ones that change the DSL does not have knowledge on programming they will find challenging and enjoyable to understand the small logic involved in a DS. They will have to put their logic in practice as opposed to use natural language where there is a lack of structure and different things with same meaning.
Think about Excel Macros. VBA is in my opinion a DSL that works near the business user. It's not plain english (well one can argue that:) and is popular enough among end users.
Matias
Apple languages are horrible, have you ever tried Objective-C?
ben,
Pay careful attention to what I said.
What I said was that given the right infrastructure, you could create such a DSL in less than an hour
English is horrible in so many ways. But since it has such lack rules and allows spelling from what is it now? 10 different languages. Took on the French non phonetic spelling conventions and then the Latin alphabet:)
Not to mention that there hasn't been spelling reform since the first dictionaries came out. Oh, well this foray started when I started teaching my now ex wife and step daughter English from a Russian background. kinda weird explaining to my wife why People is spell the way it is. ;)
So to relate to the post. English is a Horrible language to write instructions in, agreed one hundred percent.
I did assume that, and I was only joking around because I remembered you had just recently used the same phrase. Having said that, even with existing infrastructure, could you have something production ready in an hour?
yeah, let's just go back to COBOL
Just to show how bad English is:
Douglas, did you mean that your ex-wife is now your step daughter? That's just too weird!
Touche, yep exactly an issue with the language it can be interpreted both ways;) Although I could have probably spent more time and clarified the sentence. The key point is that we shouldn't have to.
But that is what gives English some of its power, it is adaptable. It is a Bastardized language that has borrowed rules from many different languages, while standardizing on a few.
I also will say I am no expert in the English language. I find it to be the most illogical pursuit of my life especially after being in a car bike accident and basically starting over on the English language in the 8th grade.
I do find that I have more interest after learning a bit of Russian, German, and a couple of other languages in review. It interested me that in Primarily English First countries that there is a Higher level of illiteracy in comparison to countries where the Language is primarily Phonetic.
Ok enough on that topic:) Speaking of a primarily Natural Language computer language, COBOL would be one of the early ones. In a fairly domain specific way.
Comment preview