7

Mah noob wannabe language designer side here again...

...Idea: Automatic/implicit interfaces.

1. do you know a language that has (something like) this?

2. good idea or a bad idea? why?

3. thanks :)

Comments
  • 1
    I think type inference in F# and Ocaml works like this.

    If the object implements all methods and properties of a type it can be used as that type.

    Not sure if this is exactly what your thinking on though.
  • 0
    @Voxera no, it's not.
    it's actually maybe probably much better than what i meant, it's a superset of what i meant, and moreover it's what i should have meant, since it's the natural consequence of some core design principles i'm basing the language on... XD
  • 2
    Looks like golang. Can't be such a bad idea if Google does it.
  • 1
    @p100sch thank you, that second sentence actually made me laugh =D

    i mean... yeah, i get what you mean, and i mostly agree, but in the context of many other things in the current world, that sentence is still pretty funny =D
  • 1
    You may want to have namespacing in the lang tho to avoid possible overlap and confusion, unless you want to force the lang user to deal with it via forced overloading.
  • 1
    @100110111
    i do have namespacing, these are just random snippets, not even using the proper syntax even for the basic stuff because I haven't really decided on it yet... =D

    well... "blocking", to be more precise. since in this language there's not much difference between a block (of code), class, function and namespace.
    all are just flavors of blocks.

    why? because it seems extremely natural and logical to me, and the separation seems mostly arbitrary to me.

    correct me if i'm wrong.
  • 0
    @100110111
    although now that I think about it... yeah, namespace will have to be a slightly more special one, precisely due to how it needs to be divided up amongst multiple files... yeah.
  • 2
    GoLang does that
  • 2
    What makes you think that if a class happens to have methods of the same name and signature that this class is this implicitly implementing the interface?

    Lookup what homonyms are for just one reason why this is a bad idea.
  • 0
    @kraator i don't have that assumption

    my assumption is that if A class has the same methods, AND it is being provided as a parameter into somewhere where B class is asked for, it's being done for a reason, that reason being that in said context, they are equivalent.
  • 0
    @kraator good point, and i'm still thinking about the whole thing, thanks.
  • 2
    @kraator "walks like a duck, talks like a duck, may be a dragon".
  • 1
    @Wisecrack
    if i decide my language to have it as a feature, i'm gonna call it "wisecracking dragon polymorphism" in your honor
  • 1
    @Midnight-shcode
    "In your honor."

    I'm honored!
  • 0
    Yeah it definitely looks like some kind of duck typing.
    And because of that, a bad idea.
    Speaking as former Objective-C dev.
  • 1
    @Lensflare thanks.
    the idea is still evolving, i'm currently looking into what and how can i snatch from functional languages, so the whole idea of how objects even conceptually are in this language is... back to almost undefined right now =D
  • 0
    Can we get some "s" property accesors? I get so tired of dot operator.

    Something like

    "Player's health" instead of "player.health"

    1. Trivial change? ✔

    2. Neurotic? ✔

    3. Gimmicky? ✔

    4. Nice change up from boring old property lookup operator? ✔

    5. Original? ✔

    6. excessively enjoying checkmark sprites?

    ✔✔✔✔✔
  • 0
    Also for language that do a lot of things right from the perspective of us in the unwashed masses. Look up:

    V lang.
    Nim.
    Beef lang
    Zig
    Brainfuck.

    Ok, maybe not that last one.
  • 2
    @Wisecrack nope, i like the dot notation.
  • 1
    @Midnight-shcode hey, you know what they say, if it works, fix it until it's broken!

    Edit: btw what are your inspirations or source languages?

    What are you using for parsing? Lexington? Compiling?
  • 1
    @Wisecrack yes, i'm doing that, but in more substantial parts of the language. breaking the type and class system has higher priority.
Add Comment