a2svior
MModular
•Created by a2svior on 9/30/2024 in #questions
Runtime Reflection in Mojo?
Does Mojo support runtime reflection, like in Golang's
reflect
? Or this is on the roadmap>
https://pkg.go.dev/reflect16 replies
MModular
•Created by a2svior on 9/24/2024 in #questions
More details on `TaskGroup` and async
Hi @Caroline @Jack Clayton , are there any details avaialble on the implementation and/or usage of the
TaskGroup
or on how to use async/schedule tasks to run concurrently in Mojo at the moment? The only example I found is this explanation by Jack https://discord.com/channels/1087530497313357884/1276206591510843443/1276210757792436234 , wondering if y'all can provide more insights?
E.g. is it possible to await tasks one by one and not the whole group at once?8 replies
MModular
•Created by a2svior on 7/15/2024 in #questions
SSL/TLS Support?
Is there anything planned for Mojo stdlib in terms of SSL/TLS? I'm thinking something like Golang's crypto/tls or Python's SSL socket wrapper
We want to add HTTPS support to Lightbug but for that would be good to know if the stdlib will include this functionality any time soon or if this has to be built by the community
42 replies
MModular
•Created by a2svior on 5/11/2024 in #questions
Passing a trait as a parameter to `Dict`?
This is related to a proposal for adding Middleware functionality to Lightbug HTTP: https://github.com/saviorand/lightbug_http/pull/33#issuecomment-2105547981
We're trying to do something like the following:
Where
routes: Dict[String, HTTPHandler]
takes in an HTTPHandler
trait which can be implemented by different handlers, including ones created by the user.
Currently, since Dict
expects a value that implements CollectionElement
, so we're getting the following error:
This persists even if HTTPHandler
extends CollectionElement
like so:
trait HTTPHandler(CollectionElement)
.
Any ideas on how we can get this to work?4 replies
MModular
•Created by a2svior on 4/5/2024 in #questions
Async function docs?
Hi! I found a mention of
async fn
and async def
in the roadmap document, but no description of how these actually work? Does Mojo support any sort of async/await workflow?
The only mention of async I see is in the changelog and just a tiny bit in the code of the coroutine in the standard library. Can we have better documentation for this?5 replies
MModular
•Created by a2svior on 1/3/2024 in #questions
Are coroutines executed in parallel?
I'm trying this example:
call_em_together() and call_em_coroutine() both print roughly 4 seconds as the result. call_em_parallel() prints roughly 2 seconds. Does that mean coroutines are not executed in parallel? Is there a way to execute them in parallel, like with goroutines in Go?
I saw a TaskGroup mentioned in the changelog but no documentation for it exists yet, and I'm not sure how to import it.
My use case is to have a blocking process/an infinite loop (e.g. a server listener) running on one coroutine , and another processes (e.g. a client making requests) executing in another in parallel
4 replies