Re: My scripting language - any suggestions?

"Felipe Angriman" <felipeangriman@gmail.com>
Mon, 8 Sep 2008 11:54:10 -0300

          From comp.compilers

Related articles
[11 earlier articles]
Re: My scripting language - any suggestions? mailbox@dmitry-kazakov.de (Dmitry A. Kazakov) (2008-09-02)
Re: My scripting language - any suggestions? licaner@gmail.com (lican) (2008-09-04)
Re: My scripting language - any suggestions? jaluber@gmail.com (Johannes) (2008-09-06)
Re: My scripting language - any suggestions? ademakov@gmail.com (Aleksey Demakov) (2008-09-07)
Re: My scripting language - any suggestions? bobduff@shell01.TheWorld.com (Robert A Duff) (2008-09-07)
Re: My scripting language - any suggestions? mailbox@dmitry-kazakov.de (Dmitry A. Kazakov) (2008-09-08)
Re: My scripting language - any suggestions? felipeangriman@gmail.com (Felipe Angriman) (2008-09-08)
Re: My scripting language - any suggestions? sammyderoy@sympatico.ca (Sammy) (2008-09-10)
| List of all articles for this month |
From: "Felipe Angriman" <felipeangriman@gmail.com>
Newsgroups: comp.compilers
Date: Mon, 8 Sep 2008 11:54:10 -0300
Organization: Compilers Central
References: 08-08-069 08-08-081 08-08-100 08-08-106 08-08-107 08-08-109 08-09-006 08-09-014 08-09-032
Keywords: types
Posted-Date: 10 Sep 2008 06:42:27 EDT

On Sat, Sep 6, 2008 at 2:02 PM, Aleksey Demakov <ademakov@gmail.com> wrote:
>
> I don't get what "covariant" or "contravariant" mean. I asked a simple
> question. Please tell me what a language "with an elaborated types
> system" will do for m(1, 2000000000,0) .
>


Type Theory Discussions always get a bit dense. Discussions of what
covariant and contravariant mean are better treated in books.
If you like to get deeper into the subject you should check this book


Benjamin C. Pierce
The MIT Press
Types and Programming Languages


This book requires some mathematical background in order to be read.
IMO it should give you a great introduction to type theory.


With repect to
> Now what will happen if one argument is int and another
> is float ?
>
> m(1, 2000000000.0)
>
> will it be 2000000001, or 2000000000,0, or a runtime error?


if types are evaluated at runtime the result i would expect it to return
the most restrictive type capable of holding the result,
in this case an integer (2000000001).


Otherwise i would expect it to return float. A Runtime error would
not be prudent if you are using IEEE 754 floating point arithmetic.
If an overflow occurred you would have +Inf as result (I think) and
of course you could check this value to see if and overflow
has taken place indeed.


I hope I was useful.


Regards,
Felipe



Post a followup to this message

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