Stream: beginners

Topic: how does the impliments keyword work?


view this post on Zulip Eli Dowling (Nov 19 2023 at 20:05):

okay i cannot for the life of me figure out how impliments is supposed to work
Like there is this which i feel like i might almost get.
In other languages it's like you are making a class. This data type is implimenting this "interface" and providing all the methods the interface requires:

LogFormatter := { data : Str }
    implements [
        InspectFormatter {
            init: init,
            list: list
#...
}]

Then we have this other syntax which uses the same keyword and is indentation based
And this is actually defining that interface

InspectFormatter implements
    init : {} -> f where f implements InspectFormatter
##...

But then i can also do this and it compiles and now I'm completely lost and have no idea what I've made

B: [BAD,GOOD]
A :={} implements[ B{b:"a"}]
var =@A {}

view this post on Zulip Brendan Hansknecht (Nov 19 2023 at 20:18):

that last example definitely looks like a bug


Last updated: Jul 06 2025 at 12:14 UTC