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
<endformationage> I have a class which is generic over a type [T: Any #send]. Within, I can use `T` as an argument to another generic type with the same constrait `Any #send`.
<endformationage> Say I have a third generic type with a constraint [U: Any #read]. Is there a way to use the 'base' type of `T` (sans refcap constraints) to instantiate this third type, which should specialize over the same 'base' type provided for `T`, but be constrianed differently with #read?
<endformationage> I suspect I cannot think of types in this way (apart from their refcap / constraints).
<endformationage> A contrived example of my intentions: https://playground.ponylang.org/?gist=6c6fb0969e41d37988d0cc855e734f78
_whitelogger has joined #ponylang
endformationage has quit [Quit: WeeChat 1.9.1]
<vaninwagen> I dont know if that helps you a lot, but #read is not a subset of #send. So with Any #send you can have iso, val or tag while with Any #read you can have ref, val and box
<vaninwagen> So only in case of val, you can actually create SomeRead
<vaninwagen> Maybe you can check for that cap with iftype, but im not sure
<vaninwagen> In general i think what you want to do is not achievable, but i have to think about it some more
<vaninwagen> tricky case
OtakuSenpai has joined #ponylang
OtakuSenpai has quit [Remote host closed the connection]
OtakuSenpai has joined #ponylang
OtakuSenpai has quit [Remote host closed the connection]
OtakuSenpai has joined #ponylang
OtakuSenpai has quit [Quit: Leaving]
endformationage has joined #ponylang
zeeshanlakhani has quit [*.net *.split]
tokenrove has quit [*.net *.split]
dom96 has quit [*.net *.split]
<endformationage> vaninwagen: To provide a bit more context. There is a separate process which, using iftype, acts as a translator between these seemingly incompatible constraints. This really only means consuming iso cases into a ref, and passing along the others.
<endformationage> My challenge I think, is that I need a way of using an even more general type param, which other params could use. Something like:
<endformationage> [T~, X: (T iso | T val | T tag), Y: (T ref | T val | T tag)]
dom96 has joined #ponylang
<endformationage> Where `T~` means the type, apart from any refcaps, and `X` and `Y` are generic types based on `T~`.
<endformationage> `T~` would only be able to be used by other generic type parameters.
<vaninwagen> I totally get your point, but i think this is not possible currently
<vaninwagen> Maybe it is possible to use a third type param and some intersection magic to achieve what you want endformationage
* vaninwagen promises to play around with this tomorrow
<emilbayes> When doing libraries/modules in pony, when is it convention to make something an actor instead of a class, and delegating it to the user to wrap the class in an actor? I'm currently looking at the http server that was extracted from stdlib
<vaninwagen> emilbayes: do you have a concrete example in mind that puzzles you?
<emilbayes> vaninwagen: Just the http server for example. Maybe I'm too locked in the thinking that threads are expensive while actors are cheap
<vaninwagen> I'd say the main reason for chosing an actor is concurrency/parallelism. A pony program is always a bunch of actors interacting in some ways. Classes are usually state inside actors or messages sent between actors.
<vaninwagen> For the http server one reason might be that it should do something not blocking other operations (handling requests etc.), e.g. it kerps track of all tcp connections in order to close them properly when disposed. This should be an asynchronous task during http serving
<vaninwagen> So it is most likely a result of how you design your little actor subsystem that is your program (or in case of a library the intended use of that lib in a program)
<emilbayes> vaninwagen: Ah yeah, and it's that decision of where you cut the concurrency that I was unsure of what best practise is. To me it feels a bit like malloc'ing in C, where you try to push it to the application as much as possible
<endformationage> vaninwagen: I've come up with a rough pattern to attempt to solve my issue. Unfortuanately it requires duplicating the involved types to split off the isolate functionality. The isolate types will take two type params, the first being `iso` for the sendable part, and the second being `ref` for the internal part.
<endformationage> That's probably not very clear based on lack of context but, I can see the possibility.
<endformationage> I don't think any intersect magic would be helpful in my case. But if you do find something that resembles my requested `T~` functionality, it could work.
zeeshanlakhani has joined #ponylang
alxs has joined #ponylang
alxs has quit [Quit: Computer's gone to sleep. ZZZzzz…]
alxs has joined #ponylang
alxs has quit [Client Quit]