Skip to content

refine Callable attributes as if they were functions and vice versa #1472

@ghost

Description

It’d be nice to be able to refine Callable attributes as if they were functions and vice versa. Things that I’d like to see working:

abstract class Foo()
{
    shared formal String(String) surround;
}

class Bar()
extends Foo()
{
    shared actual String surround(String str) => "\{RIGHT DOUBLE QUOTATION MARK}``str``\{LEFT DOUBLE QUOTATION MARK}";
}
abstract class Foo()
{
    shared formal String id(String str);
}

class Bar()
extends Foo()
{
    id = identity<String>;
    // or
    // shared formal String id = identity<String>;
}
abstract class Foo<T>()
{
    shared formal T member;
}

class Bar()
extends Foo<String(String)>()
{
    shared formal String member(String str) => "\"``string``\"";
}

A little harder to support:

abstract class Foo()
{
    shared formal String member(String str);
}

class Bar()
{
    shared formal String(String) member
    {
        if(random())
        {
            retrun(identity<String>);
        }
        else
        {
            return(function(String str) => str + "!!!");
        }
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions