Skip to content

Object-method notation #222

Open
Open

Description

@PaulBone

OO languages allow the syntax:

object.method()

To invoke a method call, and this is based around field/property access (.). Functional languages, and Plasma so far don't have this. But it's useful for guiding editor features like intelisense and also makes chaining of calls easy without additional syntax.

Plasma will use . for field access anyway, including lookups in an environment. But mostly values won't setup functions that operate on them as methods, since they won't be fields. If we do this it'll have to be defined in terms of environment access. My initial thoughts where to either let a list type say what methods it has (and how to pass itself as an argument) or to allow each method to say what "objects" it can be called on. I remember about a week ago I had an even better idea (maybe it was some syntax) but I can't remember it. Maybe it also had to do with modules since the List module is likely to contain a List type, both would refer to the map function.

Anyway, I think this could be good, but it'll need to be considered carefuly.

We should also consider how it relates to streams / comprehensions because I think we'll want a seperate syntax for LINQ-like operations that is probably more directly related to Plasma's loop syntax.

Activity

  1. added this to the milestone on Feb 7, 2020
  2. removed this from the milestone on Jan 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions