Darkmatter
Darkmatter
MModular
Created by name on 1/25/2025 in #questions
Does Mojo have a null safety feature like Dart?
A lack of pattern matching means we can't have more for now.
13 replies
MModular
Created by name on 1/25/2025 in #questions
Does Mojo have a null safety feature like Dart?
.value() is .unwrap()
13 replies
MModular
Created by thomas_huegel on 1/29/2025 in #questions
Serialize / deserialize (to JSON)
I can mark it since I'm a mod, most people can't mark other people's questions.
10 replies
MModular
Created by thomas_huegel on 1/29/2025 in #questions
Serialize / deserialize (to JSON)
right click -> Apps -> Mark Solution in the future.
10 replies
MModular
Created by name on 1/25/2025 in #questions
Does Mojo have a null safety feature like Dart?
What I would suggest for now is to not use Optional unless you want to check for the absence of the value, then the compiler will give errors like you want if someone tries to use None.
13 replies
MModular
Created by thomas_huegel on 1/29/2025 in #questions
Serialize / deserialize (to JSON)
Mojo has a plan for metaprogramming, but it's still work in progress. Python has no visibility into Mojo types because no type information makes it to runtime since Mojo is a compiled language. EmberJSON is an option, but that requires you to wire up the "to_json" and "from_json" yourself.
10 replies
MModular
Created by thomas_huegel on 1/29/2025 in #questions
Use async Python library?
You might be able to use an event loop from python if you really need to, but there's going to be very limited ability to use Mojo inside of that. I'd suggest spawning two processes and having them communicate for now.
5 replies
MModular
Created by thomas_huegel on 1/29/2025 in #questions
Use async Python library?
async in Mojo is very, very early days. I put out a "start the conversation" proposal last week.
5 replies
MModular
Created by Empathy Monster on 1/29/2025 in #questions
Admin, please help
If you have a good way to do that.
24 replies
MModular
Created by Empathy Monster on 1/29/2025 in #questions
Admin, please help
I think it might make sense to move "I'm human" to the top of that list.
24 replies
MModular
Created by name on 1/25/2025 in #questions
Does Mojo have a null safety feature like Dart?
Optional is intended for runtime checks. The documentation for Optional.value states: "If you call this without first verifying the optional with bool() eg. by if my_option: or without otherwise knowing that it contains a value (for instance with or_else), the program will abort." Due to a lack of pattern matching, there isn't a way to enforce the check right now, but that is coming. The issue you show is a trivial one, but a more realistic example would be something like the presence of a CLI flag, or whether the user's IP address geolocates to a city who's name starts with X. There's no way to tell that at compile time, so Mojo can't tell you it's None. What you've done here is roughly equivalent to using a language with null safety and ignoring the result of the null check.
13 replies
MModular
Created by Empathy Monster on 1/29/2025 in #questions
Admin, please help
Did you verify yourself? We had a spam problem so we have a verification flow to make sure users are unique.
24 replies
MModular
Created by sneekyfoxx 🦊 on 1/28/2025 in #questions
How To Get Max On Arch Linux
Right click, apps, Mark Solution
18 replies
MModular
Created by sneekyfoxx 🦊 on 1/28/2025 in #questions
How To Get Max On Arch Linux
I'd stick with the per-project version, which is much more portable.
18 replies
MModular
Created by sneekyfoxx 🦊 on 1/28/2025 in #questions
How To Get Max On Arch Linux
It also breaks Fedora.
18 replies
MModular
Created by sneekyfoxx 🦊 on 1/28/2025 in #questions
How To Get Max On Arch Linux
Mojo only officially supports ubuntu, which is where that issue is likely coming from.
18 replies
MModular
Created by sneekyfoxx 🦊 on 1/28/2025 in #questions
How To Get Max On Arch Linux
Exposing mojo globally is a bad idea, since it requires you to also expose the libraries it depends on, which will mess up a system.
18 replies
MModular
Created by sneekyfoxx 🦊 on 1/28/2025 in #questions
How To Get Max On Arch Linux
Where is that from?
18 replies
MModular
Created by sneekyfoxx 🦊 on 1/28/2025 in #questions
How To Get Max On Arch Linux
MAX and Mojo currently re-use conda environments, via a tool called magic, to help with portability.
18 replies
MModular
Created by sneekyfoxx 🦊 on 1/28/2025 in #questions
How To Get Max On Arch Linux
Are you inside of a magic virtual environment?
18 replies