Python from Wise Guy's Viewpoint

F

Fergus Henderson

Pascal Costanza said:
I am not sure if I understand you correctly, but are you actually
suggesting that it is better to reimplement Common Lisp on your own than
to just use one of the various Common Lisp implementations?

No. I'm just pointing out that these sort of things can be implemented
in statically typed languages without much difficulty. Generally
I _don't_ want to reimplement Common Lisp. If on occaision I do need
some dynamic binding, or dynamic typing, say, then this need is usually
localized within a small part of the application, and so I can implement
what I need very easily.

Your article that I was responding to was suggesting that there might
be some things which could not be done in statically typed languages,
and in particular that this sort of eval(read()) loop might be one of them.
As I hope I've demonstrated, it is not.

So in answer to question "d" in that post of yours, "would you still
disagree with the assessment there is a class of programs that can be
implemented with dynamically typed languages but without statically
typed ones?", I would say yes, I still disagree.
 
F

Fergus Henderson

Pascal Costanza said:
b) documentation

Documentation can be handled well with comments and well-chosen names.

Certainly it _can_ be, but keeping good, up-to-date documentation is a
difficult task. In my experience, average programmers do a better job
of documentation in languages which encourage explicitly declaring the
types of interfaces than in those which do not.
 
J

Jon S. Anthony

Fergus Henderson said:
Well, DEFTYPE in lisp really just defines a function, doesn't it?
So that's not much different than DEFUN. Likewise, DEFCLASS just
defines a collection of functions, doesn't it? OK, maybe these
also record some extra information in some global symbol tables.
That is easily emulated if you really want.

I don't know exactly what DEFPACKAGE does, but if the others are any
guide, it's probably not too hard either.

Yes, if you reimplement Lisp you can achieve what was asked. However,
I don't think "turing equivalence" or Greenspun's tenth was the point...

/Jon
 
P

Pascal Costanza

Fergus said:
Your article that I was responding to was suggesting that there might
be some things which could not be done in statically typed languages,
and in particular that this sort of eval(read()) loop might be one of them.
As I hope I've demonstrated, it is not.

And you're right in this regard. My statement was too strong. Of course
it is always possible to reimplement a dynamic language on top of a
static one and by this get the full expressive power of a dynamic
language. But I didn't have Turing equivalence in mind when I made that
statement. The real question is how hard it is to reimplement a dynamic
language, and wouldn't it be a better idea to use a dynamic language
when the requirements are of the sort that, when in doubt, flexibility
turns out to be more important than stacity.


Pascal
 
N

Neelakantan Krishnaswami

^^^
How many do you need of those, especially when you want to allow that
type to be extended in the running program?

Two more.

datatype generic = ...
| Class of generic ref
| Object of generic array ref

Then you can write a typeof function that looks at tags to decide what
to do.

This shouldn't be that hard to see: an implementation of Scheme or
Lisp doesn't require an infinite family of tags in the lower-level
implementation.
 
F

Fergus Henderson

Pascal Costanza said:

Then the answer is obviously no -- regardless of which language you use,
and whether it is statically typed or not. In some cases the interpreter
might be included as part of the standard library or even as a builtin-in
language feature, in other cases it may need to be written as part of the
program, but either way, it will still need to be included.
...that you can't statically type check your code as soon as you
incorporate an interpreter/compiler into your program that can interact
with and change your program at runtime in arbitrary ways.

This conclusion doesn't follow. How could it, since neither the question
nor the answer made any reference to static type checking?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top