Object-method notation #222
Labels
component: compiler
Concerning the compiler
meta: triaged
Has the issue been triaged yet?
skill: mercury
status: new
A new bug, we may or may not fix it.
type: enhancement
OO languages allow the syntax:
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 theList
module is likely to contain aList
type, both would refer to themap
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.
The text was updated successfully, but these errors were encountered: