Syntax question...

Jarrett Billingsley kb3ctd2 at yahoo.com
Wed Nov 1 06:47:52 PST 2006


"RA" <ra at wolven.net> wrote in message 
news:ei8ij4$21ql$1 at digitaldaemon.com...
> The kind of syntax I'm thinking of would be one that would be easily 
> readable and
> understood by virtually any programmer. It would be more verbose than
> C\C++\D\etc..  and cleaner and more  logical than VB.  Simple, readable, 
> logical
> and consistent would be the primary goals.  I would try to use generally
> understood words and symbols except where they just don't make sense 
> unless you've
> been "educated" as to their meanings within a particular language. 
> Obviously,
> that's not a completely achievable goal, but a worthwhile target in my 
> opinion
> nonetheless.

An admirable goal.

> Here are a few examples.  I think ==, &&, ||, etc. suck.  = means equal, 
> not ==.
> I would change the & and | symbols to something new.  I would change the * 
> to the
> "normal" multiplacation symbol (little x floating midline), the / to the 
> normal
> divide symbol, the ! to the normal not equal (equal with a diagonal slash 
> thru it,
> and I would use the ascii decimal 171 and 187 ((hex 00AB and 00BB) they 
> look like
> small << and >>) as the "literal" identifiers instead of quotation 
> marks... and so
> forth and so on.

I don't know how I'd type any of those, though.  Now you're getting into APL 
territory ;)

> Things like "If a !<= b" just don't make any sense to me.  I think it's 
> much
> clearer and correct as "If a > b".  Anyone that would use !<= is just 
> being
> perverse IMO... :)

Actually !<= is not necessarily "not less than or equal" -- it's a special 
operator for comparing floating point numbers which takes into account NaNs. 
But again, typing the "not less than or equal" character on a keyboard is 
not very easy, nor is it probably supported under many fonts or under ASCII.

> I would use; Do, DoWhile, DoUntil, EndDo, EndDoWhile, EndDoUntil, If, 
> EndIf,
> BegFunction, EndFunction, BegProp, EndProp, etc...
>
> I liked and applauded your "no need for '->'" comment in your VB example.

Oh, I didn't make that -- that was in the original D example (have a look on 
the intro page of the spec).  There's no -> in D either.

> I've been an application programmer for over 20 years.  For the first 10 
> years I
> worked on the IBM S\36 and AS\400 using RPG.  The next 10 years was 
> programming
> Windows using Visual RPG (kind of a cross between freeform RPG and VB).
>
> One thing I've noticed over the years is that with each new generation of
> programming languages and operating systems, I keep getting moved closer 
> and
> closer to system level programming.  As a supposedly "high level" 
> programmer,
> personally, I find that annoying.  The fact that I "can" write my own 
> string
> object is entertaining (if I felt like it), but the fact that I HAVE to 
> absolutely
> sucks.
>
> Nice features that were built into the OS and language\compiler I used 15 
> years
> ago have dissappeared and now I have to do them MANUALLY.  That sux. 
> Memory
> management? Garbage collection?  Ten years ago, I had no idea what that 
> meant.  I
> didn't NEED to because the OS and compiler took care of it for me...
> AUTOMATICALLY!  God, what a novel concept.

I think what's really happened is that there are still high-level languages, 
but low-level languages have come into their own so much that they're now 
popular for things like app development.  Back in the late 70s, early 80s, 
what languages were there?  You had the _really_ low level ones used for 
writing OSes, and then the much higher-level ones (like Smalltalk etc.) used 
for writing more interesting programs.  But now the low-level languages have 
taken on many features from the high-level ones and have become more useful 
for things other than raw hardware access.

There are still plenty of high-level languages that don't have explicit 
memory management or the need to program your own String object, e.g. Java, 
C#, Ruby, Python, Perl etc.  And to a large extent, D ;)

> A few things I've noticed mentioned on the forums here... integer, double, 
> float,
> unsigned integer, decimal, and on and on.  WTH is that about?  All I want 
> is a
> NUMBER with nine digits and two decimals...  you can store it in memory 
> ANY DAMN
> WAY you like, but I don't NEED to know or care about it.  And I damn sure 
> don't
> want to have to manually convert "cast" it to make my math work.

Well D is a _systems_ programming language and not necessarily a numerical 
or financial programming language.  As such, having precise control over the 
number of bits and format of any given number is crucial for proper 
interfacing with various APIs.  An eleven-digit fixed-point number doesn't 
mean much to most OSes and libraries, and so having such a type in D would 
not make sense either.

> I think Walter mentioned that no one has a nice data file handling system. 
> Other
> than the AS\400 and ASNA's duplication of that file system on Windows, 
> I've never
> seen anything "nice".  MSSQL, MySQL, etc... are a royal pain in the hiney,
> anything but nice.  I've come to the conclusion that the only reason those 
> things
> are used is because MOST programmers have never worked on a "nice" system 
> with a
> "nice" OS, language and database.
>
> Anyway...  enough ranting.  :)
>
> I really like what I've read on here about Walters tossing of "legacy"
> compatibility and ignorant "features" of C++ when designing D.  And trying 
> to make
> it more modern with garbage collection, eliminating pointers (although it 
> sure
> seems to have a lot of support for them), etc..

Again, the support for pointers is because lots of systems code needs them. 
D thankfully provides enough other abstractions, however, so that most of 
the time you need not deal with them.  About the only time I use pointers is 
with the associative array "in" operator and allocating structs on the heap, 
things which don't happen _too_ often.

> I just personally don't care for the syntax. But given my background, I 
> think
> that's understandable.  I think it would be great to give D a second 
> syntax that
> would be "easier" to learn\understand for people that aren't coming from a 
> C
> background.  Much the same way MS has C# and VB.
>
> What do you think?

I think you're entirely justified in your opinion, and a language like that 
which you describe would probably be very useful to a lot of people. 
However, I don't know if D is really the right language to try to fit to 
your vision.  You could change the syntax, but if you can't change the 
semantics, you won't be any closer to your dream.

Have a go at making your own language then.  It's fun, and that's from 
experience ;) 





More information about the Digitalmars-d mailing list