why ; ?

Yigal Chripun yigal100 at gmail.com
Tue May 13 22:35:48 PDT 2008


Christopher Wright wrote:
> Yigal Chripun wrote:
>> personally I don't understand why we still use text files to represent
>> code. that's just so silly. data in a computer is stored in binary form
>> not text, so you don't get to see your "real" code anyway, but rather a
>> specific interpretation of it. and this encoding is very old and very
>> simplistic. this is identical to word for example only difference is the
>> format used by word is a different binary encoding.
> 
> I've used Lingo, a proprietary programming language that uses a binary
> format for code. Of course, the code is largely textual, so it's the
> worst of both worlds.
> 
> The largest issue is finding an efficient means of recording intent that
> is Turing-complete (and can easily be translated to machine code). Text
> fulfills that wonderfully. Human languages do not, for a variety of
> reasons. You could come up with a pixelmap solution that is reasonable,
> but it would be compilable to text without significant difficulty, and
> text is probably easier to read and write.
> 
> The second largest issue is editors. Once you have your visual
> programming language, everyone needs an editor that can display it in
> order to program for it, which is a considerable barrier to entry. I
> tried learning Lingo recently, and though most of the code involved is
> text, it's in a binary format along with images and other data, so you
> can't hope to learn it without shelling out $800 for Adobe Director.
> Even if the editor were free, even if it were available for all
> platforms, it would still require everyone to use that editor, no matter
> its quality. And there are wars over editors, so this is no trivial matter.

while that's true, it doesn't really prevent us from having a language
that has a more rich representation. also note, I didn't say we should
ban the use of text, merely that we shouldn't be limited by text.
text is a binary format too as I said earlier, the only difference is
that you already have many free editors for it. that's a bit of an egg
and a chicken problem. but that shouldn't force us to limit ourselves to
only text. look at Java for instance, it already is used almost
exclusively with IDEs, you can use a text editor with Java of course,
but in practice, nobody does that. the next step would be to write a
language with a rich representation and provide an eclipse plugin for it.

the point of this is not to find something easier for the computer to
understand, but to find something more easy for humans to use. finding a
way to generate code from human languages is probably hard, I agree. the
benefit would be that you will not need to be a programmer to create a
program. you could just describe your problem to the PC and it'll
understand it and generate a solution. (maybe this needs AI for that.)

another line of thinking is this: why do we need a general purpose
Turing-complete language anyway? programmers deal with abstractions,
right? we are constantly trying to raise the level of those abstractions
to make them closer to the domain of the problem. otherwise we would
still be using assembly since all the Turing complete languages have
equal power. so everything you can do with D (for instance) is possible
to do in assembly as well (it'll be harder to program, though).

what's the next level of abstraction, than? let's define a DSL (domain
specific language) that describes our problem domain and use that
language to solve the problem. SQL for example is very good at DBs and
it isn't even Turing complete. so instead of using one general purpose
language (which internally has to have design trade-offs) you can choose
the language for the job or create a new one. (there's an interesting
article about this idea by the jetbrains developers with their MPL
system, you can google it up - highly recommended to read)

by doing this we have just added another level of abstraction. now your
code is written in a a set of specific DSLs suitable for your problem.
those are translated to a general purpose language like D or Java, which
then is compiled and linked to a binary.
this way you can use graphics to design the GUI, SQL for DB access, and
other languages for other stuff.



More information about the Digitalmars-d mailing list