taskThe Nosica programming language - Tasks: task #984, Implements multi-methods

 
 
Show feedback again

You are not allowed to post comments on this tracker with your current authentification level.

task #984: Implements multi-methods

Submitted by:  David Jobet <djobet>
Submitted on:  Mon 25 Oct 2004 08:58:27 PM UTC  
 
Should Start On: Mon 25 Oct 2004 12:00:00 AM UTCShould be Finished on: Mon 25 Oct 2004 12:00:00 AM UTC
Category: CompilerPriority: 1 - Later
Status: NonePrivacy: Public
Percent Complete: 0%Assigned to: None
Open/Closed: OpenEffort: 0.00

Mon 25 Oct 2004 08:58:27 PM UTC, original submission:

In fact, leave Nosica invariant, but allow implementation of multi methods ...
That is,

interface B {}
interface A {
sub f(B b);
}
class AImpl implements A {
public sub f(BImpl b) {} // compil time error, covariance is not allowed
}
class AImpl2 implements A {
public sub f(B b) {} // OK interface is implemented (invariance)
public sub f(BImpl b) {} // this is a specialisation of the implementation of
method A.f(B) : a multi method
}

B b = new BImpl();
A a = new AImpl2();
a.f(b); // will call AImpl2.f(BImpl) through multiple dispatch

As the language is invariant, method f(B) must be implemented ... This is a type
safe compiler construct. (cannot fail at runtime).
As the language allows multi methods (via multiple dispatch), we allow a kind of
covariance that is much powerfull ...

That is we have the best of the two worlds ...
See forum for details on implementation ...

David Jobet <djobet>
Project Administrator

 

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by djobet (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    No Changes Have Been Made to This Item
    Show feedback again

    Back to the top


    Powered by Savane 3.1-cleanup