edvardo1

edvardo1

Hello, I’ve found an interesting non-backwards-compatible change in Elixir 1.20.

For context: There exists a project called PolyHok, which is a DSL that is embedded in Elixir, its aim is to make GPU programming easier in Elixir, I am one of the people participating in the development of this DSL.

The main way you’re supposed to use it is by using the PolyHok.defmodule macro, which basically overloads the defmodule construct, it processes the defk (define kernel) and defd (define device function) expressions, takes them out of the module body, then process that module normally. Now, I know that that’s not the most orthodox way to do it, as Nx doesn’t do it like that, but it worked in previous versions. Here’s an example:

require PolyHok

PolyHok.defmodule Wow do
  defk myk(a) do
    a[1] = 9.2
  end

  def f() do
    2
  end
end

In Elixir 1.19.6, it functions normally and you can use the defk definition for whatever you wanna use it for, but for Elixir 1.20 and later, it spits out this error:

    error: undefined function defk/2 (there is no such import)
    │
  4 │   defk myk(a) do
    │   ^
    │
    └─ elixir/examples.exs:4:3: Wow (module)

** (CompileError) elixir/examples.exs: cannot compile module Wow (errors have been logged)

Does anyone why this happens, why the behavior was changed, and if there is an easy way to fix this?

Links for the curious:
PolyHok website: PolyHok: GPGPU in Elixir []
PolyHok repository: GitHub - lups-ufpel/poly_hok: PolyHok DSL repository. · GitHub

Showing Posts 1 to 1

a-maze-d

a-maze-d

The release note for 1.20 does contain the following. Not sure this helps you:

[Kernel] Show undefined function errors even when missing variables (this helps debug errors caused when the developer forgets to require a macro)

— All posts loaded —

Where Next? Top

Trending in Troubleshooting Top

edvardo1
Hello, I’ve found an interesting non-backwards-compatible change in Elixir 1.20. For context: There exists a project called PolyHok, whi...
New
andrewf
I’m using Postgrex in a Phoenix app to connect to Postgres. The database for my dev instance is in a local VM, with hostname jot.local. M...
New

Other Trending Topics Top

GenericJam
Edit: 2026 May 15 - This post is archived. Mob is alive!! Main docs: mob v0.7.11 — Documentation A bit of explanation for the slightly c...
New
JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
mhanberg
Hi everyone! The first release candidate for the Expert language server project is now available! We’ve published a press release detai...
New
georgeguimaraes
Just published claude-code-elixir, a plugin marketplace for Claude Code with Elixir support. These are the plugins I’ve been using for my...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews