[GAP] advice on Ada in general programming languages course
Alejandro R. Mosteo
alejandro at mosteo.com
Thu Apr 21 17:08:52 CEST 2005
Robert Dewar wrote:
> Alejandro R. Mosteo wrote:
>
>> There are a some obstacles in teaching Ada to novices that I find it's
>> important to alleviate as fast as possible: string types are a glaring
>> example (provide some package based around unbounded strings). These
>> kind of things are at first completely ackwards to people used to
>> scripting/gc languages. While is important to understand properly the
>> unconstrained types, I see no point in doing exhaustive manipulation
>> of character buffers when doing I/O at first. That's just boring and
>> painful. At least that's what I remember from my Ada (83) origins.
>
>
> Can you say why Unbounded is not OK as is (why it needs wrapping), and
> give some idea of what wrapping you have in mind?
Fair point.
Let's see, I don't see nothing fundamentally wrong in Unbounded, but
when you start adding the "no use" rule, throw in some I/O needs
(another package(s) to with/instantiate), all that after being as
teacher in the uneasy situation of saying "yes, String is a string but
to do that is easier to use this package...", you're already in a
somewhat defensive position.
For this reason, I see a general-purpose package for comfortable
string+IO manipulation a great aid to novices. Shorter conversion
functions (I hated the "To_Unbounded_String"). First programs tend to
involve string/number manipulation (and hence some console output). That
can quickly require a few packages. So, if you're adding another package
to the mix, why not just have only one for your students to use. That
allows for better focusing in other aspects.
This is a thing that has always been in my mind about standard packages.
There are some that provide everything you can need, but lack just the
extra "ergonomy" factor. An example: if you want to trim some string,
you need to with two packages and call a function in one with arguments
in the other (Ada.Strings and Ada.Strings.Fixed IIRC). It may be that I
lose time over too tiny details, kind of a neurosis, but I find these
things disturbing.
I'm sorry I can't better express the feeling I got when I was learning
Ada, english is not my primary language.
More information about the GAP
mailing list