Re: My scripting language - any suggestions?

"Aleksey Demakov" <ademakov@gmail.com>
Sun, 7 Sep 2008 00:02:32 +0700

          From comp.compilers

Related articles
[8 earlier articles]
Re: My scripting language - any suggestions? licaner@gmail.com (lican) (2008-08-31)
Re: My scripting language - any suggestions? mailbox@dmitry-kazakov.de (Dmitry A. Kazakov) (2008-09-01)
Re: My scripting language - any suggestions? ademakov@gmail.com (Aleksey Demakov) (2008-09-02)
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: "Aleksey Demakov" <ademakov@gmail.com>
Newsgroups: comp.compilers
Date: Sun, 7 Sep 2008 00:02:32 +0700
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
Keywords: types
Posted-Date: 07 Sep 2008 17:32:52 EDT

On Wed, Sep 3, 2008 at 12:22 AM, Dmitry A. Kazakov
<mailbox@dmitry-kazakov.de> wrote:
> On Tue, 2 Sep 2008 00:54:12 +0700, Aleksey Demakov wrote:
>> Suppose we have a method that simply returns the sum of two args:
>>
>> m(a, b) { return a + b; }
>
> First of all, this is not a specification of the method. The types of the
> arguments and of the result are unspecified, as well as the covariance of.
> So one cannot tell which combinations of arguments and result types are
> involved.
>


We were talking in the context of a scripting language. If you notice
the variables in this language are declared as "var a = 5;". No type
tag whatsoever. I don't see a reason why for such a language
parameters are to be declared with the type tag. But if you wish I
could write the method definition like this:


Float m(Float a, Float b) { return a + b; }


> As for multimethods, yes there are six combinations of 3 (2 arguments + 1
> result) x 2 types. The semantics of m shall unambiguously define all six.
> But again it is not the language business, except for the predefined
> operations of course. The language shall merely allow an implementation of
> the desired semantics for all combinations in question.
>


What do multimethods have to do with this? You say that a language
"with an elaborated types system" should make integer a subtype
of float. My understanding of subtyping is that a subtype might go
anywhere the supertype could go. I conclude that there is no need for
any 6 combinations. The method defined for float arguments should
somehow handle int arguments too.


> The result is involved, provided that m is covariant, or else when Float is
> the ancestor of Integer and the result is contravariant. As for the
> semantics (numerical value of the result), see above.
>


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) .


Regards,
Aleksey



Post a followup to this message

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