On 3/1/2012 5:25 AM, Martin Baldan wrote:
Hi,

What got me wondering this was the fact that people, as far as I know, don't use domain-specific languages in natural speech. What they do use is jargon, but the syntax is always the same. What if one could program in something like ACE, specify a jargon and start describing data structures concisely and conveniently in a controlled language? That way, whenever there is a new problem, you would only have to specify what kind of entities you want to use, what properties they can have, and so on.

I guess I want something like this:

http://en.wikipedia.org/wiki/Semantic-oriented_programming


What are your thoughts?


(not entirely sure I understand "SOP" at the moment, so responding more "in general").


to some extent, this is a role served by packages/namespaces in languages which have them. namely, each package may have its own collections of various objects, which one can use via importing it.

otherwise, it is useful to have a reasonably expressive core language (IMO: this is where languages like Java fall on their face...), such that ideally it is not really necessarily for people to roll their own syntax and semantics for various tasks.

otherwise, the language should not be rigidly stupid in brain-damaged ways (also, IMO, a bit of a problem with Java and friends). this is where something "could" be presumably trivially expressed in the language, if only the compiler allowed it.

this was one area where C did a lot better than Java (and to a some extent, C++). in C, nearly everything in the syntax which wasn't a statement, was an expression; more so, C code is essentially just a list of expressions separated by semicolons (with a few exceptions, such as declarations and block-statements).

now, Java sort of "watered it down" a bit, by adopting a more watered down concept of "an expression", and essentially making most everything else be fixed form statements. not everything was bad: they watered down declarations in a way that made parsing them syntactically unambiguous (a problem in both C and C++ is that one needs to deal with context to be able to correctly parse the code, but both Java and C# mostly addressed this problem).

a weakness in Java, though, is that one can only call "methods", say:
"object.method()", "package.class.method()", ..., rather than being able to call arbitrary expressions (like in C and C++); there are also no first-class functions or methods (C and C++ had these implicitly, C# "added" them as "delegates"), seriously it took until the JDK7 for Sun/Oracle to get around to adding them (never-mind the half-baked "lambdas"/"closures", which don't properly capture scope, and which require using a method to call "lambdaObj.invoke(...)", ...);
for fairly obvious reasons, one can't do curried functions in Java.

nevermind some ways Java's type-system is brain-damaged, ...


ultimately, all of its limitations and arbitrary restrictions IMO make Java a bit lame as a language (coupled with the weak JVM architecture), is part of why although I could technically support both, I didn't really bother maintaining it (I personally found it preferable to port Java code to my BGBScript language, which is, IMHO, less arbitrarily stupid, albeit at the cost of there being some minor syntactic differences which are kind of a hassle, such as the different type-cast syntax, ...).


a language which allows, say:
first class functions, and closures with semantics that make sense (they retain a copy of the parent scope, not some read-only by-value copy, or have the closure become invalid as soon as the parent returns);
calling arbitrary expressions, and using curried function calls;
ability to use dynamic and inferred types without a lot of extra pain;
ability to roll ones' own scoping as needed (such as via the use of delegation);
...

is a bit more useful IMO.
if the core language can compactly express ones' intents, why need a specialized DSL to try to be more compact?...


the weakness of C++, like that is Java, is that many of its newly added features were bolted on in often one-off forms, and where orthogonality either fails, or introduces new arbitrary "features" to address cases which should have theoretically followed from taking the prior features to their logical extremes (granted, it is not like C++ hasn't taken many of its features to extremes though...).

a bigger weakness though is that both the syntax and semantics are, in some was, ad-hoc, over-complicated, and its dependence on context has become a bit excessive.

or, at least, this is a few of my thoughts at the moment.


or such...



_______________________________________________
fonc mailing list
fonc@vpri.org
http://vpri.org/mailman/listinfo/fonc

_______________________________________________
fonc mailing list
fonc@vpri.org
http://vpri.org/mailman/listinfo/fonc

Reply via email to