News for hackers. Stuff that matters.
Re:Decorator JITs: Python as a DSL by sevensor on Monday February 03, 2025 @12:24PM (#42920547)
The misleading thing about this approach is that the decorated function is no longer Python at all. It’s another language with Python syntax. Which is a neat way to get a parser for free, but it’s going to set up expectations about semantics that are bound to be incorrect.
Re:Decorator JITs: Python as a DSL by dragonwriter on Monday February 03, 2025 @03:48PM (#42922875)
> The misleading thing about this approach is that the decorated function is no longer Python at all. It’s another language with Python syntax.

Some of the current implementations are either strict Python subsets or very nearly so, but, yes, DSLs are distinct languages, that's what the L stands for.

Re:Decorator JITs: Python as a DSL by almostgotcaught on Monday February 03, 2025 @02:55PM (#42922134)
worse is you can't set a breakpoint inside the "jitted" function (maybe can't print either...)
Re:Decorator JITs: Python as a DSL by cl3misch on Monday February 03, 2025 @04:13PM (#42923216)
Re:Decorator JITs: Python as a DSL by almostgotcaught on Monday February 03, 2025 @04:53PM (#42923756)
> In JAX you can

I'm alway shocked when people in this line of work either take things at face-value or just lie by omission/imprecision. this is not python breakpoints - it's a wholeass other system they had to re-roll that emulates python breakpoints:

> Unlike pdb, you will not be able to step through the execution, but you are allowed to resume it.

you think it works with pycharm/vscode/any other tooling? spoiler alert: of course not.

so no in JAX you can not.

Re:Decorator JITs: Python as a DSL by ByteMe95 on Monday February 03, 2025 @09:09PM (#42926686)
You can in CSP nodes https://github.com/Point72/csp
Re:Decorator JITs: Python as a DSL by richard_shelton on Monday February 03, 2025 @04:20PM (#42923330)
It's funny how close it is to the title of my talk "Python already has a frontend for your compiler": https://github.com/true-grue/python-dsls