Lil'Nish
Lil'Nish
MModular
Created by Stephen on 1/7/2025 in #questions
Why is `"\0A"` the default `end` value for `print`?
I think it's a typo. It probably means to say 0x0A (or 10 in base 10) which is ascii for the new line character \n
6 replies
MModular
Created by duck_tape on 1/3/2025 in #community-showcase
A Benchmark with Files and Bytes
Does mojo have small string optimization by default? If so, it may be appropriate to use arraystring (or some other stack based string implementation) in rust
24 replies
MModular
Created by duck_tape on 1/3/2025 in #community-showcase
A Benchmark with Files and Bytes
Fiar enough, ig there's no need to manually implement a SIMD version then
24 replies
MModular
Created by duck_tape on 1/3/2025 in #community-showcase
A Benchmark with Files and Bytes
tho SIMD is not a huge selling point of rust and requires unsafe or external crates, so even if rust wins with SIMD, it may not be a fair comparison...
24 replies
MModular
Created by duck_tape on 1/3/2025 in #community-showcase
A Benchmark with Files and Bytes
When I get a chance, I'll create a SIMD rust version
24 replies
MModular
Created by gamendez98 on 2/19/2024 in #questions
How long until mojo is production ready(guesstimate)?
Even rust (which i would consider an "I can handle the truth" language) provides .unwrap(), which would be similar to this, allowing devs to ignore errors they know are impossible/extremely unlikely for their use case
89 replies
MModular
Created by gamendez98 on 2/19/2024 in #questions
How long until mojo is production ready(guesstimate)?
Reading though the rest of the convo now. I think I like this method the most.
89 replies
MModular
Created by gamendez98 on 2/19/2024 in #questions
How long until mojo is production ready(guesstimate)?
It introduces a "boy who cried wolf" scenario where it becomes unclear if a raises function actually has a moderate change of failing (like a network request), or if it only has raises because it appends to a list somewhere
89 replies
MModular
Created by gamendez98 on 2/19/2024 in #questions
How long until mojo is production ready(guesstimate)?
I agree that having two versions of the same function is not ideal, but I think it's better than sticking raise onto every function, bc if we do this, it may become difficult to know when we should handle a functions exception and when it isn't necessary to (for example, webservers typically don't care about handling allocation failures).
89 replies
MModular
Created by gamendez98 on 2/19/2024 in #questions
How long until mojo is production ready(guesstimate)?
Is there a reason we couln't just implement two functions. .append() which will just fail in the case of an allocation failure and .append_raises() raise which will allow the programmer to gracefully handle the error?
89 replies
MModular
Created by Lil'Nish on 11/16/2024 in #questions
Vale Status
That would be a good place to go wouldn't it? Thanks!
5 replies
MModular
Created by Lil'Nish on 11/15/2024 in #questions
Clarification on the Meaning of Python Superset
Hey Caroline, thanks for the response. Great to see that supersetting Python is still on the road map!
5 replies
MModular
Created by banananas on 10/23/2024 in #questions
Creating files from code
The only difference from "x" mode is that it will overwrite an existing file with the same name (if it's there) instead of throwing an exception
10 replies
MModular
Created by banananas on 10/23/2024 in #questions
Creating files from code
"w" mode also creates the file
10 replies
MModular
Created by banananas on 10/23/2024 in #questions
Creating files from code
However, I don't think Mojo supports opening a file in "x" mode yet, so you'll need to ensure that the file doesn't already exist manually
10 replies
MModular
Created by banananas on 10/23/2024 in #questions
Creating files from code
You can use the open() function in a context manager in Mojo the same way you would in python, there's no need to interop any python code for this.
fn create_proj(filepath: String) raises:
if os.path.exists(filepath):
raise Error("File already exists.")

with open(filepath, "w") as f:
f.write(String("text goes here"))
fn create_proj(filepath: String) raises:
if os.path.exists(filepath):
raise Error("File already exists.")

with open(filepath, "w") as f:
f.write(String("text goes here"))
10 replies
MModular
Created by Lil'Nish on 10/22/2024 in #questions
Could Mojo be the first all purpose language?
I was referring to programming languages rather than query languages or proof verification tools, but thanks for the input! Wouldn't Mojo need to support dynamic typing and python libraries to be a super set of python? Or are you saying that even if this is true, it won't matter since using the pythonic syntax would be frowned upon.
15 replies