|How to implement dynamic typing? firstname.lastname@example.org (David Belier) (2010-04-02)|
|Re: How to implement dynamic typing? email@example.com (glen herrmannsfeldt) (2010-04-06)|
|Re: How to implement dynamic typing? firstname.lastname@example.org (andy johnson) (2010-04-06)|
|Re: How to implement dynamic typing? email@example.com (2010-04-06)|
|Re: How to implement dynamic typing? firstname.lastname@example.org (bartc) (2010-04-06)|
|Re: How to implement dynamic typing? email@example.com (Paul Biggar) (2010-04-06)|
|Re: How to implement dynamic typing? firstname.lastname@example.org (Ian Lance Taylor) (2010-04-06)|
|Re: How to implement dynamic typing? email@example.com (Barry Kelly) (2010-04-07)|
|[23 later articles]|
|From:||glen herrmannsfeldt <firstname.lastname@example.org>|
|Date:||Tue, 6 Apr 2010 06:37:46 +0000 (UTC)|
|Organization:||California Institute of Technology, Pasadena|
|Posted-Date:||07 Apr 2010 01:41:52 EDT|
David Belier <email@example.com> wrote:
> Recently I finished chapter 7 of the dragon book (2nd edition) but I
> still don't understand how to implement dynamic typing. I don't get
> how you are supposed to store the type information with each variable
> and check it every time using an acceptable amount of resources and
> time. Can someone please name papers or websites to read?
The languages that I know of that use dynamic typing are all
interpreted, sort of by definition. In that case the overhead is
usually less than the overhead already there in an interpreter.
For a compiled language there would be a tradeoff, as you say,
between time and space. Space efficient would be a subroutine
call for each evaluation. Time efficient, though still slow,
would be many switch/case constructs, each based on the possible
type at that point.
If, for example, like awk you had only two types (string and
double precision floating point numeric) then it might not be
so bad. Only two choices, and always the possible conversion
to the other type. As the number of types increase, the
combinations grow exponentially...
Return to the
Search the comp.compilers archives again.