Modular

M

Modular

This server is the home of the MAX and Mojo community. Join us to chat about all things Modular!

Join

questions

community-showcase

Safe pointers

Currently Mojo has no checks related to out of bounds for pointers. Is it going to change in the future?

Are coroutines executed in parallel?

I'm trying this example: ``` fn main(): async fn my_async_fn() -> Int: sleep(2)...

Passing generics to DynamicVector

I'm trying to understand the traits system and am working with a toy list struct from this thread The original declaration (which works) starts with: ``` @value...

Are Type Hints Still Possible in Mojo?

Hi all - I was wondering, is there a way to write a def function in Mojo that uses type hints like in Python 3? For example I tried writing this earlier. I'm guessing it's not the right approach though, as the compiler gives a warning that cannot use a dynamic value in type specification ```...

Owned convention does not destroy variable after transferring ownership

Hello everybody! I am working on a project that has a small exercises to learn Mojo. Currently, I am working on value ownership section and was playing with a code below. ```python TASK Make file compile with no errors...

When will Mojo support windows directly?

When will Mojo support windows directly?

Pip Support

Will there will be pip Support or will we need to always bind Python modules manually ?

Adding __takeinit__ makes a difference in assignment

I'm playing with HeapArray and I cannot understand what is going on. ```python struct HeapArray: var data: Pointer[Int]...

Python assert

Hi all, I am trying to use some existing Python code in Mojo. I couldn't find an alternative for the "assert" statements I use for testing the code. What's the best solution for this?

Can someone help me with this error please

Hi, I wanted to create mathematical functions for matrices (e.g addition, subtraction, multiplication, ect) However I am running into an error with the return statement in all of the operations. Many thanks for any advice. Error: ``` error: value of type 'Matrix' cannot be copied into its destination...

Documentation of .as_ptr and ._steal_ptr

Hi all, for some reason I can't find any documentation and usage examples of these methods (and the difference between them). Any hints where I can find it? Also - steal_ptr states than the caller is responsible to free the underlying memory. How one could do that? Thanks!...

any Windows + Vscode (using WSL2 as middle-man) guide?

Basically what title says. I'd like to run my mojo code using a shortcut inside vscode, which then runs the code inside WSL inside the vscode terminal. No clue how to approach this. Thanks :)...

Why doesn't __bool__ allow explicit conversion?

I am playing with "Low level IR" level and it works great. However when i try to print out OurBool i get errors stating that OurBool can not be converted to Bool despite having a __bool__ method. I am using Mojo 6.1 ```rust @register_passable("trivial")...

Usage examples within Mojo docs:

Is there a plan to add usage examples to mojo's documentation. For example: for a type such as DynamicVector, can we add simple but easy to understand examples for each of its methods. Right now, I only see definitions for them.

Autocomplete (tab) crashes playground kernel

I'm trying out the BoolMLIR.ipynb on the Mojo playground. When I add a cell and start typing __ml+tab, I hoped to get autocompletion but instead, the kernel dies. Should this work or not yet?...
No description

TraitsRequiring Static Methods

What am I doing wrong below? please help. trait HasStaticMethod: @staticmethod fn work(): ......

Python w Mojo

Will more of python be supported with mojo and will there be any modules available to just get stuck in with ai.

Running Mojo executable at Alpine docker

I created a mojo dockerfile the is working fine:
FROM ubuntu:latest
FROM ubuntu:latest
...

Does a pragma exist to switch off `mojo format`

I love the convention part of source code formatting rules: teams should not argue (too much) about formatting. Do this discussion once, agree on something that works for everyone (convention). Let the standard tooling handle it. However, teams often agree that it needs to be switched off sometimes. Question: Is there something to switch off sections of code that should not be formatted. A @format on/off would do....