IRC channel logs
2025-07-19.log
back to list of logs
<ArneBab>Would you have interest of having define-typed in Guile? <daviid>fwiw, no pun, but I personally, I think this is a wrog approach - what would be order of mag better, imo, is to implement the CL declare approach, and then this declaration to be used by our compiler <daviid>so, I perso would prefer this not to make it to guile core <ArneBab>Then I’ll create an outside package. <ArneBab>My main reason for starting define-typed is that I want to create API boundaries, but I’m happy that it can now actually improve performance :-) <ArneBab>daviid: why do you think that declare is better? <mwette>I agree w/ daviid. Instead of replacing define, add something to signal the compiler, like `declare' or `pragma' : (define (mag x) (pragma #:type (x float?)) ... <mwette>I'd be inclined to stick with predicates: (and (real? x) (inexact? x)) <mwette>Also, there is lambda, case-lambda, lambda*, ... <mwette>What files need updating to add an intrinsic? So far I have intrinsics.[hc], primitives.scm, cps-primitives.scm, and assembler.scm. I'm getting an 'unbound interesting primitive' error. <ArneBab>mwette: doesn’t that then step outside Scheme and would be non-portable? define-typed is just a syntax-rules macro (not even syntax-case). <ArneBab>If I created pragma with a syntax-rule I wouldn’t have access to the procedure, so I couldn’t add the types as properties and could not write editor-level tools for type-linting. <ArneBab>(or rather: the editor-level tools would have to always analyze the source code instead of being able to check the procedure properties in a REPL) <mwette>Didn't Guile recently get something like docstring but for procedure properties, like a vector? I don't remember exactly. <mwette>Yes. (define (foo x) #((a . 1) (b . 2)) #t) (procedure-properties foo) <mwette>(procedure-properties (lambda () #((hello . "arne")) #f))