I think we need dbg
to be a keyword rather than using dispatch after all
the problem is, if I use it in a call chain like foo.dbg().bar()
then it's obvious that dbg
returns whatever you give it
but then if I use it as a standalone statement like foo.dbg()
then I'll get a warning because it doesn't evaluate to {}
so then either I need to write _ = foo.dbg()
or else we have to make an exception for dbg
on top of which, in general it's weird to have it look like a normal pure function because it doesn't get optimized away like pure functions are allowed to be
I think it's usual enough that it just makes more sense to be a keyword
so I think we should do:
dbg foo
works like expect foo
as a statement
or return foo
and then if you want it in a call chain, we allow foo->dbg.bar()
(or whatever we end up using for the non-dispatch call chain; I'm default assuming ->
but that could change)
:thinking: I suppose we could also allow ->expect
and even ->return
if desired
I'm glad you say this, because this is how I've implemented dbg
so far in the compiler :rofl:
Last updated: Jul 06 2025 at 12:14 UTC