Re: [Caml-list] Re: some comments on ocaml{lex,yacc} from a novice's POV

Jon Harrop <jon@ffconsultancy.com> writes:
> Note that, in this case, I was referring to the detection of grammar
> conflicts and not static type checking.
>
Sorry -- that notion didn't come across very well in your message. The
criticism was misplaced. (And I hope that my response didn't come off as
an "ad hominem" fallacy.)
> Can you give an example where dynamic typing has helped you to prototype a
> program more quickly than you could have done with static type checking?
>
It happens quite often when I write code for a specification that is
incomplete and I have to go back and change something. For example, I was
recently working on a recursive decent parser for some grammar. I was
interested to see what sentences in the grammar would look like, how they
would parse, and other things of this nature. Basically, I was coding to
flush out the inadequacies of the design.
I was doing this in OCaml, but I found that I had to constantly create new
types to represent the different forms that could be found in the parse
tree. Often, it would involve moving some element from one type to
another. This resulted in me making minor changes to a few different
functions in order for the program to type check. It would have been
considerably simpler to just throw the element into a cons cell with the
first element being a symbol/string/whatever that just described the
element. Then I would just write code that checked if the car/head of the
cons cell was X and if so, do something with it.
I am not advocating that this code would be suitable for release. In fact,
I would have little faith in it and would probably be embarassed to release
it. However, incrementally developing some program that does not have much
of a specification seems to be much simpler if I don't burden myself with
the act of conjuring up types for everything. Once I've gone through a
couple iterations of the program, then I'm very interested in some form of
strong type checking to make sure that I'm not missing the little things.
--
Geoff Wozniak