why is this return a copy?
```py
@value
struct UnixSocket:
var address: Optional[UnixAddress]
var fd: Int32...
Not sure why these strings are missing the last char
```py
buf = InlineArrayUInt8, 32
while True:
client = server.accept()
read = client.read_into(buf)...
List of references in Mojo
I'm a bit out of the loop with the latest Mojo developments, so I could use some guidance.
In Python, creating a list of references is simple:
```python
m1 = [1, 2]...
mojo compile is non-deterministic ? (video)
I only call
mojo run main.mojo
again and again, and
- it breaks
- it gives a result
- it gives another result
I can't see where the randomness is coming from, it is certainly not intended...print breaks code
the following isn't catched by the linter but breaks, what am I doing wrong?
```
from python import Python, PythonObject
from memory import memcpy...
List of SIMD bug
The following simple code doesn't work, is this because of memory? I find the documentation is lacking, it only says SIMD are restricted to powers of 2, which I compy with...
```
alias S: Int = 256
alias S2: Int = S*S
alias SquareMatrix = SIMD[size=S2]...
alias and os.getenv
Hi I have a question regarding constants and env variable.
I was hoping to do something like
```...
How do safe Reference and List work together?
From my understanding
Reference
is just a pointer in memory with associated lifetime. But I don't understand how the following code doesn't crash
```
var list: List[Int] = List(10,11,12)
var element = Reference(list[0])
list.resize(0)...Fastest way to count trailing zeros from a SIMD[Bool,32]?
The summary says it all.
I have a SIMD with 32 bools, and would like to find the first appearance of a True value.
Right now I'm doing the following:
...
How to publish on github in these magic times
I'm wondering if there's a recommended way to publish Mojo/Max projects on GitHub , now that we have Magic as the recommended installation tool. Among other questions:
* In mojoproject.toml, how should we set platforms = ["osx-arm64", "linux-64"]?
* Should we recommend users to use magic shell or magic run?
* ......
Error on magic self-update
Failed to fetch packages data
├─▶ error sending request for url (https://dl.modular.com/public/magic/raw/index.json)
├─▶ client error (Connect)
├─▶ dns error: failed to lookup address information: Try again
╰─▶ failed to lookup address information: Try again...
Magic/Mojo on MacOS 12 not supported?
Just starting to play around with Mojo. Following the instructions in the docs on MacOS 12 on an M1 macbook I am getting this error on running
magic shell
about MacOS 13 being required. I can't find any docs suggesting MacOS 12 is not supported. Googling that error, I can't find anything relevant. So before I go to the trouble of updating the OS I thought I'd ask whether anyone else has experienced this.
```
$ magic shell
× The current system has a mismatching virtual package. The project requires '__osx' to be at least version '13.0' but the system has version '12.4'...Does Mojo implements the Debug Adapter Protocol?
Could we understand that Mojo implements the Debug Adapter Protocol? Meaning, it's created by Microsoft and we can debug Mojo in vscode, so I guess then we could use it for debugging Mojo in other IDEs like nvim (using nvim-dap). Am I right?
Is there a disdain for Rust from the Mojo team?
I read Chris' proposal on naming of provenance.
I don't understand why can't we just adopt Rust's convention of using
&'a T
and &'a mut T
instead of going one round of inventing new keywords ref[lifetime]
and refmut[lifetime]
.
Mojo is unique on its own:...Value Semantics and async code
What does Mojo's value semantics mean for writing asynchronous code? Can Mojo sidestep the problem of coloured functions, or make it easier to write asynchronous code?
Mojo vs Rust memory safety
Does Mojo's value ownership and lifecycle mean that it can compete with Rust for memory safety?
threading in mojo
Does mojo have an abstraction for threading like python and c++ 'std::thread' . I saw a coroutine struct in docs , is that the expected model for concurrency use cases ?
How to use mojo in jupyter notebook with the new magic based installation of max-mojo?
Any recommended steps to use jupyter notebook with mojo, now that it is installed with magic cli.
How to improve the performance of formatting output
I wrote a piece of scientific simulation code as shown below:
```mojo
fn run(inout self) raises -> None:
with open(self.output_path, "w") as f:
var out: String = "location,velocity,acceleration\n"...