Python from Wise Guy's Viewpoint

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Pascal Costanza

    Re: Python from Wise Guy's Viewpoint

    Fergus Henderson wrote:
    [color=blue]
    > 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.[/color]

    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

    --
    Pascal Costanza University of Bonn
    mailto:costanza @web.de Institute of Computer Science III
    http://www.pascalcostanza.de Römerstr. 164, D-53117 Bonn (Germany)

    Comment

    • Neelakantan Krishnaswami

      Re: Python from Wise Guy's Viewpoint

      In article <boqboc$4p2$1@f 1node01.rhrz.un i-bonn.de>, Pascal Costanza wrote:[color=blue]
      > Fergus Henderson wrote:
      >[color=green]
      >> Suppose the original ML program defines the following functions
      >>
      >> foo : int -> int
      >> bar : string -> string
      >> ...
      >>
      >> We can add dynamic typing like this:
      >>
      >> datatype Generic = Int of int
      >> | String of string
      >> | Atom of string
      >> | Cons Generic Generic
      >> | Apply Generic Generic
      >> | ...[/color]
      > ^^^
      > How many do you need of those, especially when you want to allow that
      > type to be extended in the running program?[/color]

      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.


      --
      Neel Krishnaswami
      neelk@cs.cmu.ed u

      Comment

      • Fergus Henderson

        Re: Python from Wise Guy's Viewpoint

        Pascal Costanza <costanza@web.d e> writes:[color=blue]
        >Fergus Henderson wrote:[color=green]
        >>Pascal Costanza <costanza@web.d e> writes:[color=darkred]
        >>>Fergus Henderson wrote:
        >>>>The program includes a definition for "eval", and "eval" is an
        >>>>interpreter , So in that sense, we have added a new interpreter.
        >>>
        >>>That's the whole point of my argument.[/color]
        >>
        >> Then it's a pretty silly argument.
        >>
        >> You ask if we can implement eval, which is an interpreter,
        >> without including an interpreter?[/color]
        >
        >Right.[/color]

        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.
        [color=blue][color=green]
        >> I don't see what you could usefully conclude from the answer.[/color]
        >
        >...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.[/color]

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

        --
        Fergus Henderson <fjh@cs.mu.oz.a u> | "I have always known that the pursuit
        The University of Melbourne | of excellence is a lethal habit"
        WWW: <http://www.cs.mu.oz.au/~fjh> | -- the last words of T. S. Garp.

        Comment

        Working...