announcements

Chemaclass 2026-06-01T10:00:05.480499Z

Phel v0.41 is out: Fold and Inline phel 🚀 1. Clojure parity fixes </>/<=/>= reject nil instead of coercing 2. Lazy seq alignment map/filter/remove/concat/repeatedly/distinct no longer pre-realize their head. True laziness, Clojure-style. 3. Call-site lowering persistent collection ops, numeric chains, predicates, count/empty?/contains?/deref on tagged values 4. And more stuff -> https://github.com/phel-lang/phel-lang/releases/tag/v0.41.0

10
🚀 9
Ahmed Hassan 2026-06-06T04:24:42.323789Z

__invoke with only this parameter was giving error to me.

Chemaclass 2026-06-06T09:01:52.514429Z

That error is intended, not a bug. A struct is already callable as a map (`invoke(mixed $key)` does key lookup), so PHP forces any custom __invoke override to keep a compatible signature: at least one required arg, or variadic. [this] compiles to a zero-arg __invoke() → incompatible → PHP would fatal at class-declaration time, so Phel rejects it at compile with a clear message instead. Working forms:

(__invoke [this x] ...)     ; one arg
(__invoke [this & xs] ...)  ; variadic
;; If you want a "call it with no meaningful arg" struct, use a variadic tail and ignore it:
(__invoke [this & _] 42)   ; (m) or (m anything) → 42
Just pushed https://github.com/phel-lang/phel-lang/pull/2347 so the error message itself points at the [this & _] trick. 🙏

1
Chemaclass 2026-06-06T10:19:08.208179Z

@ahmed1hsn everything what we talked is ready in the latests https://github.com/phel-lang/phel-lang/releases/tag/v0.42.0

👍 1
Chemaclass 2026-06-06T12:28:52.190849Z

@ahmed1hsn this can be helpful -> https://phel-lang.org/blog/php-interop-modern-syntax/

🎉 1
Ahmed Hassan 2026-06-02T20:00:12.345149Z

I asked similar question previously, and you provided an implementation using Symfony DBAL. But I'm curious how can we implement src/Entity/Product.php using Phel? https://symfony.com/doc/current/doctrine.html#creating-an-entity-class

Ahmed Hassan 2026-06-02T20:06:20.508209Z

one way I can think of is to make PHP files for Doctrine with PHP Attributes and then consume it from Phel.

Ahmed Hassan 2026-06-05T22:17:00.720169Z

@clojurians-slack.htsg how can we use magic methods like __invoke?

Chemaclass 2026-06-05T22:26:08.318759Z

@ahmed1hsn Key points: • Object with __invoke treated as callable. Emitter compiles (d 21)$d(21), PHP triggers invoke. • Works in higher-order spots (`map`, filter, apply) too. • Other magic methods reached via normal interop: ◦ __get / __set(php/-> obj prop) / (php/oset (php/-> obj prop) val)__call(php/-> obj (anyMethod args))__callStatic(php/:: Cls (anyMethod args))__toString(php/-> obj (__toString)) or (str obj) context

1
Ahmed Hassan 2026-06-05T22:37:30.608939Z

can we define __invoke on defstruct ??

Chemaclass 2026-06-05T23:05:38.075349Z

Yes, via inline protocol impl on defstruct. defstruct emits a real final class extends AbstractPersistentStruct. Inline definterface/`defprotocol` method impls become actual PHP methods on that class. Name one invoke → struct is callable.

(definterface Callable2
  (__invoke [this x]))

(defstruct Multiplier [factor]
  Callable2
  (__invoke [this x] (* x (get this :factor))))

(def m (Multiplier 3))
(php/is_callable m)  ; => true
(m 14)               ; => 42        ; PHP triggers __invoke
(map m [1 2 3])      ; => @[3 6 9]  ; works as fn anywhere

👍 1
Chemaclass 2026-06-05T23:08:18.657659Z

@ahmed1hsn however, your idea was pretty good so I will work on it to improve the DX https://github.com/phel-lang/phel-lang/pull/2346

Kirill Chernyshov 2026-06-01T12:37:29.587369Z

https://github.com/DotFox/edn.c#writer now writes EDN, not just reads it Value-tree writer — serialize to string, buffer, FILE, or a callback. Compact by default, optionally pretty-printed. Ryū-accurate doubles + sortable map/set optional output for stable, round-trip-faithful EDN. Streaming emitter — a YAJL-style push API (edn_emitter_ / edn_emit_) that produces EDN incrementally, no value tree needed. https://github.com/DotFox/edn.c#writer

🙌 1
🙌🏻 1
🎉 22