TeamPuzel
TeamPuzel
MModular
Created by TeamPuzel on 9/15/2023 in #questions
When (if ever) can we expect arbitrary target support?
In Zig you can choose almost any target triple you need and it works, cross compilation is trivial too. Currently Mojo does not allow this, rejecting most targets - is this just a temporary limitation or is every target going to require patches to the compiler like Swift? Rust is also not that great here requiring installation of a separate toolchain for each target if I remember correctly.
1 replies
MModular
Created by TeamPuzel on 9/12/2023 in #questions
`llvm.add` is interpreted as `llvm.addrspacecast`
./std/primitive.mojo:71:64: error: 'llvm.addrspacecast' op requires a single operand
value: __mlir_op.`llvm.add`[_type: __mlir_type.i32](self.value, rhs.value)
./std/primitive.mojo:71:64: error: 'llvm.addrspacecast' op requires a single operand
value: __mlir_op.`llvm.add`[_type: __mlir_type.i32](self.value, rhs.value)
This feels like it's not working correctly, considering add is documented as something else.
102 replies
MModular
Created by TeamPuzel on 9/10/2023 in #questions
Will there be built in testing support like in Zig or Rust?
Something Rust makes very easy to set up is testing, and Zig makes this even easier by just having test "name" { ... } declarations. The less friction there is for good practices like this the more people tend to do it. Would something like this be considered for mojo at some point?
20 replies
MModular
Created by TeamPuzel on 9/9/2023 in #questions
Why doesn't fn() coerce to fn() capturing
This works thanks to the signatures being different:
fn first(self, where: fn(T) -> Bool) -> Optional[T]:
for item in self:
if where(item): return item
return Optional[T]()

fn first(self, where: fn(T) capturing -> Bool) -> Optional[T]:
for item in self:
if where(item): return item
return Optional[T]()
fn first(self, where: fn(T) -> Bool) -> Optional[T]:
for item in self:
if where(item): return item
return Optional[T]()

fn first(self, where: fn(T) capturing -> Bool) -> Optional[T]:
for item in self:
if where(item): return item
return Optional[T]()
However it's still annoying to duplicate every function twice.
4 replies
MModular
Created by TeamPuzel on 9/8/2023 in #questions
VSCode extension not working on Linux
The output error is:
2023-09-08 21:12:09.901 [error] TypeError: The argument 'options' must have the property "port" or "path". Received {}
at new NodeError (node:internal/errors:387:5)
at Server.listen (node:net:1615:11)
at /home/teampuzel/.vscode/extensions/modular-mojotools.vscode-mojo-0.2.1/out/debug/externalDebugLauncher.js:177:54
at new Promise (<anonymous>)
at RpcLaunchServer.<anonymous> (/home/teampuzel/.vscode/extensions/modular-mojotools.vscode-mojo-0.2.1/out/debug/externalDebugLauncher.js:177:20)
at Generator.next (<anonymous>)
at /home/teampuzel/.vscode/extensions/modular-mojotools.vscode-mojo-0.2.1/out/debug/externalDebugLauncher.js:13:71
at new Promise (<anonymous>)
at __awaiter (/home/teampuzel/.vscode/extensions/modular-mojotools.vscode-mojo-0.2.1/out/debug/externalDebugLauncher.js:9:12)
at RpcLaunchServer.listen (/home/teampuzel/.vscode/extensions/modular-mojotools.vscode-mojo-0.2.1/out/debug/externalDebugLauncher.js:176:16)
at MojoDebugContext.updateOrCreateRpcServer (/home/teampuzel/.vscode/extensions/modular-mojotools.vscode-mojo-0.2.1/out/debug/debug.js:82:19)
at new MojoDebugContext (/home/teampuzel/.vscode/extensions/modular-mojotools.vscode-mojo-0.2.1/out/debug/debug.js:64:18)
at MOJOContext.<anonymous> (/home/teampuzel/.vscode/extensions/modular-mojotools.vscode-mojo-0.2.1/out/mojoContext.js:68:35)
at Generator.next (<anonymous>)
at fulfilled (/home/teampuzel/.vscode/extensions/modular-mojotools.vscode-mojo-0.2.1/out/mojoContext.js:10:58)
2023-09-08 21:12:09.901 [error] TypeError: The argument 'options' must have the property "port" or "path". Received {}
at new NodeError (node:internal/errors:387:5)
at Server.listen (node:net:1615:11)
at /home/teampuzel/.vscode/extensions/modular-mojotools.vscode-mojo-0.2.1/out/debug/externalDebugLauncher.js:177:54
at new Promise (<anonymous>)
at RpcLaunchServer.<anonymous> (/home/teampuzel/.vscode/extensions/modular-mojotools.vscode-mojo-0.2.1/out/debug/externalDebugLauncher.js:177:20)
at Generator.next (<anonymous>)
at /home/teampuzel/.vscode/extensions/modular-mojotools.vscode-mojo-0.2.1/out/debug/externalDebugLauncher.js:13:71
at new Promise (<anonymous>)
at __awaiter (/home/teampuzel/.vscode/extensions/modular-mojotools.vscode-mojo-0.2.1/out/debug/externalDebugLauncher.js:9:12)
at RpcLaunchServer.listen (/home/teampuzel/.vscode/extensions/modular-mojotools.vscode-mojo-0.2.1/out/debug/externalDebugLauncher.js:176:16)
at MojoDebugContext.updateOrCreateRpcServer (/home/teampuzel/.vscode/extensions/modular-mojotools.vscode-mojo-0.2.1/out/debug/debug.js:82:19)
at new MojoDebugContext (/home/teampuzel/.vscode/extensions/modular-mojotools.vscode-mojo-0.2.1/out/debug/debug.js:64:18)
at MOJOContext.<anonymous> (/home/teampuzel/.vscode/extensions/modular-mojotools.vscode-mojo-0.2.1/out/mojoContext.js:68:35)
at Generator.next (<anonymous>)
at fulfilled (/home/teampuzel/.vscode/extensions/modular-mojotools.vscode-mojo-0.2.1/out/mojoContext.js:10:58)
6 replies