Re: How to implement dynamic typing?

"bartc" <bartc@freeuk.com>
Sun, 11 Apr 2010 11:46:24 -0000

          From comp.compilers

Related articles
[6 earlier articles]
Re: How to implement dynamic typing? iant@google.com (Ian Lance Taylor) (2010-04-06)
Re: How to implement dynamic typing? barry.j.kelly@gmail.com (Barry Kelly) (2010-04-07)
Re: How to implement dynamic typing? torbenm@diku.dk (2010-04-07)
Re: How to implement dynamic typing? ctalk@ctalklang.org (Ctalk Project) (2010-04-07)
Re: How to implement dynamic typing? gneuner2@comcast.net (George Neuner) (2010-04-07)
Re: How to implement dynamic typing? cr88192@hotmail.com (BGB / cr88192) (2010-04-10)
Re: How to implement dynamic typing? bartc@freeuk.com (bartc) (2010-04-11)
Re: How to implement dynamic typing? harold.aptroot@gmail.com (Harold Aptroot) (2010-04-11)
Re: How to implement dynamic typing? cr88192@hotmail.com (BGB / cr88192) (2010-04-11)
Re: How to implement dynamic typing? cr88192@hotmail.com (BGB / cr88192) (2010-04-12)
Re: How to implement dynamic typing? gneuner2@comcast.net (George Neuner) (2010-04-13)
Re: How to implement dynamic typing? bartc@freeuk.com (bartc) (2010-04-14)
Re: How to implement dynamic typing? dot@dotat.at (Tony Finch) (2010-04-14)
[12 later articles]
| List of all articles for this month |

From: "bartc" <bartc@freeuk.com>
Newsgroups: comp.compilers
Date: Sun, 11 Apr 2010 11:46:24 -0000
Organization: virginmedia.com
References: 10-04-009 10-04-028
Keywords: types
Posted-Date: 12 Apr 2010 01:31:19 EDT

"BGB / cr88192" <cr88192@hotmail.com> wrote in message
> "David Belier" <davidbleier@hotmail.com> wrote in message
>> 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?
>
> as others have said, it is not stored with the variable.


Yes, quite a few people have said that.


Yet, I *do* store a tag with the variable! So clearly I must be doing
something wrong...


In:


  A := (1, "two", 3.0)


a tag is stored with the variable A (saying it is a list), but tags are also
stored for each of the values (saying they are an integer, a string, and a
float).


(In this implementation, A is not a pointer, it is a descriptor containing,
for this example, the list tag, the length of the list (3), and a pointer to
the elements, each in turn being a descriptor.)


So more accurately tags can be stored with both variables and values.


--
Bartc



Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.