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

karlosmid
Hi Parker and Shannon, First, thank you for Oban and Oban Web. They’re a pleasure to build on, and the resolver’s format_job_args/1 and ...
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
budgie
A little off-topic, but I feel like people here have a good head on their shoulders. I used to be quite good at making software. Was luc...
New
KristerV
Hey. Is there anyone here who creates agents in their apps? Not talking about using agents, but creating them. I’m finding it pretty diff...
New
mudasobwa
I fully migrated to my own harness from Anthropic/Gemini and I think it’s time to share it. Welcome DSH, the DeepSeek Harness, fully writ...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
juhalehtonen
There has been a thread to discuss the Stack Overflow Developer Survey on this forum every year since 2018, so here’s yet another one for...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews