jemc changed the topic of #ponylang to: Welcome! Please check out our Code of Conduct => https://github.com/ponylang/ponyc/blob/master/CODE_OF_CONDUCT.md | Public IRC logs are available => http://irclog.whitequark.org/ponylang | Please consider participating in our mailing lists => https://pony.groups.io/g/pony
amclain has quit [Quit: Leaving]
smoon has joined #ponylang
smoon has quit [Client Quit]
smoon has joined #ponylang
chemist69 has quit [Ping timeout: 268 seconds]
smoon has quit [Quit: smoon]
smoon has joined #ponylang
smoon has quit [Quit: smoon]
chemist69 has joined #ponylang
<endformationage> Is it redundant to mark constructors val if the class is already marked val?
gmcabrita has quit [Quit: Connection closed for inactivity]
chemist69 has quit [Ping timeout: 240 seconds]
chemist69 has joined #ponylang
aav has quit [Ping timeout: 264 seconds]
aav has joined #ponylang
k0nsl has quit [Quit: “If we don't believe in freedom of expression for people we despise, we don't believe in it at all — Noam Chomsky”]
k0nsl has joined #ponylang
k0nsl has joined #ponylang
k0nsl has quit [Changing host]
k0nsl has quit [Quit: “If we don't believe in freedom of expression for people we despise, we don't believe in it at all — Noam Chomsky”]
k0nsl has joined #ponylang
k0nsl has joined #ponylang
k0nsl has quit [Changing host]
<jemc> endformationage: no, the two indicate different things
<jemc> the `class val Foo` means that anywher in source code where you see the type `Foo` with no explicit cap, the implicit cap is `val`
<jemc> the `new val create` means that the result of the constructor is a `Foo val`
<FunkyBob> subtle
<FunkyBob> one controls what "let foo : Foo" means
<jemc> but if you don't give an explicit cap on the constructor, it is always `ref` (except for actors, which must always construct as a `tag`))
<FunkyBob> the other what "let foo = Foo.create()" means
<jemc> FunkyBob: yep
<endformationage> jemc: Ah, got it. Subtle indeed.
<FunkyBob> both rely on implicit, which is bad, mmmkay? :)
chemist69 has quit [Ping timeout: 240 seconds]
<endformationage> Hmm, I am getting clashing symbols between the logger and net/http packages.
chemist69 has joined #ponylang
papey_lap has joined #ponylang
<endformationage> OK, resolved with package alias.
jemc has quit [Ping timeout: 240 seconds]
jemc has joined #ponylang
<endformationage> Getting a strang errors after aliasing logger package: couldn't find 'log' in 'StringLogger'
<FunkyBob> ah
<FunkyBob> I think I hit this
<FunkyBob> can you dpaste your code?
<endformationage> FunkyBob: https://dpaste.de/mo2q
<endformationage> .. how I've set it up. Pretty standard
K4rolis has joined #ponylang
jemc has quit [Ping timeout: 268 seconds]
<endformationage> Here is a compiled code example with error: https://dpaste.de/gfGA
<endformationage> Kind of looks like a bug?
<FunkyBob> back
<FunkyBob> let _logger: lgr.StringLogger
<FunkyBob> what if you change that to Logger[String] ?
<FunkyBob> AIUI StringLogger.apply is a Logger[String] factory
<endformationage> I'll give it a try
vaninwagen_ has joined #ponylang
<endformationage> OK, got those error to clear up by replacing with Logger[String] as you suggested
<endformationage> Odd, I just copied over what the StringLogger does for you.
<endformationage> Thanks for the suggestion!
<FunkyBob> np
<FunkyBob> I did have the same in kt
fluttershy_ has joined #ponylang
<fluttershy_> hello,, i saw this line in a jemc's code ¨let output = recover trn Array[U8] end ¨ what does it actually do ? is it a way to define an array without initializing ?
<endformationage> fluttershy_: I believe the Array[U8] is sugar for Array[U8].create(), which does init and array of lenght 0.
<fluttershy_> ok, but I don't understand why he uses recover trn
<endformationage> it would also return the array as ref^, but jemc changed (recovered) the reference capability to trn
<endformationage> Besides that, and without further context, I'm probably too new to give you an appropriate explaination of reference capabilities.
<fluttershy_> ok, thank you endformationage
<endformationage> But, the recover trn ... end , is to change the array from being a ref to a trn. Why, has all to do with the context the expresion is used in.
<doublec> fluttershy_: a trn is writeable and safely convertable to a val later
<doublec> fluttershy_: so useful for objects that start off needing initialisation of some sort then passing around as a val
<doublec> fluttershy_: which you can see is what is happening in that code
<endformationage> the return is a val type
<doublec> right
<doublec> 'inner' is the same. It's created as a trn, ref methods are used to change it, then it's consumed to be appended to 'outer'.
<fluttershy_> ah!! Thanks I understand now :)
<endformationage> I've been battling compiler errors for hours, and finally came up to type arg constraint error, but I've not read about type constraints much.
<doublec> Generics and the thorniest part of Pony in my experience
<doublec> s/and/are/g
<doublec> Not too bad if the type parameter can just be val. Much harder if you want to handle iso type parameters as well.
<endformationage> One error has me worried after all this: 'an interface can't be a subtype of a trait', and I feel I've structured my code in a way that'll require a redo. :/
<endformationage> Time to sleep on it. I'm sure I'll have a ton of questions after I read up on it!
endformationage has quit [Quit: WeeChat 1.7]
fluttershy_ has quit [Quit: Page closed]
gmcabrita has joined #ponylang
<SeanTAllen> endformationage: interfaces do structural typing, traits do nominal typing. thus the interface can't be a subtype of trait. an interface that is a subtype of a trait would no longer be structural typing, it would be nominal typing. hopefully that makes sense.
chemist69 has quit [Ping timeout: 240 seconds]
chemist69 has joined #ponylang
_andre has joined #ponylang
obadz has quit [Ping timeout: 260 seconds]
obadz has joined #ponylang
k0nsl has quit [Quit: “If we don't believe in freedom of expression for people we despise, we don't believe in it at all — Noam Chomsky”]
vaninwagen_ has quit [Ping timeout: 260 seconds]
k0nsl has joined #ponylang
k0nsl has joined #ponylang
k0nsl has quit [Changing host]
_andre_ has joined #ponylang
k0nsl has quit [*.net *.split]
_andre has quit [*.net *.split]
gmcabrita has quit [*.net *.split]
gmcabrita has joined #ponylang
k0nsl has joined #ponylang
chemist69 has quit [Ping timeout: 260 seconds]
k0nsl has quit [*.net *.split]
gmcabrita has quit [*.net *.split]
k0nsl has joined #ponylang
k0nsl has joined #ponylang
k0nsl has quit [Changing host]
gmcabrita has joined #ponylang
plietar has joined #ponylang
chemist69 has joined #ponylang
TheNet has joined #ponylang
TheNet has quit [Quit: Textual IRC Client: www.textualapp.com]
plietar_ has joined #ponylang
plietar has quit [Ping timeout: 264 seconds]
TheNet has joined #ponylang
jemc has joined #ponylang
Praetonus has joined #ponylang
amclain has joined #ponylang
TheNet has quit [Quit: Textual IRC Client: www.textualapp.com]
plietar has joined #ponylang
plietar_ has quit [Ping timeout: 260 seconds]
endformationage has joined #ponylang
<endformationage> SeanTAllen: Makes perfect sense, thanks for the explaination.
Matthias247 has joined #ponylang
Praetonus has quit [Quit: Leaving]
aav has quit []
plietar has quit [Remote host closed the connection]
plietar has joined #ponylang
plietar has quit [Ping timeout: 240 seconds]
plietar has joined #ponylang
chemist69 has quit [Ping timeout: 260 seconds]
chemist69 has joined #ponylang
_andre_ has quit [Quit: leaving]
bapop has joined #ponylang
bapop has quit [Client Quit]
<endformationage> Am I correct to say that object literal 'fields' are not accessable like normal object public fields? I.e. a `let s: String = ...` in an object literal cannot be accessed like object_literal.s
<jemc> no, that's not correct
<jemc> any public fields in the object literal can be accessed from outside the object, just as you would with any other object
<endformationage> Hmm, I must be doing wrong, as I cannot access either fields OR methods defined on an object literal.
<jemc> if you paste your code I can probably give you some helpful guidance
<endformationage> Putting together an example on the playground...
<jemc> endformationage: ah, your issue is not the object itself, but the trait
<jemc> in Pony, the type of a reference within a given context is the only source of information about *what* you can do with it, determined statically (at compile time, not at runtime)
<jemc> within `Main.create`, you have an object of type `CategoryOfLiterals`, and within that context, that's all you know
plietar has quit [Remote host closed the connection]
<jemc> you can't read the `s` field or call the `test` method on that object, because the `CategoryOfLiterals` type does not have that field or that method
plietar has joined #ponylang
<endformationage> Hmm. I see.
<jemc> this example demonstrates reading the field and calling the method on the object literal, where the reference is of an "anonymous" type that the object literal evaluates to form - basically an anonymous class that includes all the fields and methods of that object literal
<jemc> going back to your example, think of the type as a contract
<jemc> `object is CategoryOfLiterals` is saying that your object literal will adhere to that contract
<jemc> but it's your `trait CategoryOfLiterals` is what defines the terms of that contract
<endformationage> OK
plietar has quit [Ping timeout: 264 seconds]
<jemc> your trait has no methods, so the contract is totally empty
<jemc> (note that a trait cannot have fields, so those can never be part of a trait's contract)
<endformationage> Is the only way to send and object literal is to make it concretely fulfill a contract? and capture as that contract type?
Matthias247 has quit [Read error: Connection reset by peer]
<jemc> yeah, pretty much the only practical way to pass an object literal around is to do it "behind" an interface or trait, because the type of an object literal is anonymous, so you can't "name" it anywhere in your code that needs to receive it
<endformationage> Ok.
plietar has joined #ponylang
papey_la1 has joined #ponylang
papey_lap has quit [Ping timeout: 240 seconds]