freenode/lisp - IRC Chatlog
Search
22:01:34
ldb
aeth: a typical solution is discriminate binary + and reduced + using some kind of rewriting
22:06:47
ldb
it is easy to conclude this kinds of &rest is a binary operator extended to folding with a unit object
22:08:03
aeth
ldb: yes, but I don't need to go that far, I just need to turn (R7RS::+ ...) into (CL:+ ...) of course with any additional overhead around it (e.g. continuations) although I suppose it's not quite that simple because someone in user code could do something like (let ((+ -)) ...) because Schemes usually don't have something like e.g. SBCL's package lock on CL
22:09:02
aeth
I'll probably just catch CL's TYPE-ERROR around +, too, instead of slowing down arithmetic with my own checks.
22:10:34
srandon111
guys do you think that nowadays all the shining features lisps have are also contained in other programming languages?
22:11:58
phoe
srandon111: CL still has pretty unmatched runtime introspection, interactivity, and debuggability
22:12:20
no-defun-allowed
Macros are either not present in most languages, or they're a bit of a joke because they only perform textual substitution (C) or the syntax is far detached from the data they process, leaving one with a line noise pattern matcher to make macros with (Rust, et al)
22:12:43
aeth
srandon111: CL comes with INCF that's like += and ++ in one (if the number isn't provided, it's like ++, otherwise like +=) but lacks *= but you can just do (define-modify-macro multf (&optional (delta 1)) *) (let ((x 2)) (multf x 42)) => 84
22:12:57
aeth
The point of a Lisp is that you don't have to wait on a new version of the standard for new syntactic sugar.
22:14:49
aeth
ldb: No, Pseudoscheme did a very direct translation to CL, hence the "pseudo" in Pseudoscheme. It lacked key features like call/cc iirc. Also, modern Scheme has syntactically and semantically drifted more in r7rs than in the days of r4rs (where e.g. hygienic macros were just an optional appendix)
22:15:24
aeth
ldb: Airship Scheme is intending to be a conforming r7rs Scheme so it has to introduce overhead where there is a semantic mismatch, but ideally no overhead if there is not.
22:15:51
jcowan
phoe: In my view, that II&D is a Good Thing, but it embiggens implementations that don't actually require it
22:17:50
aeth
ldb: well, yes, but I can't just say "OK, the input is (* x y (+ z u v w)) so the output is now (* x y (+ z u v w))" because of the continuation passing style and because, as I said, the user could just do (let ((+ -)) (* x y (+ z u v w)))
22:24:13
aeth
ldb: I mean, at the moment, I have a series of Common Lisp macros for this, so if you choose to put up with the reader mismatches (like t instead of #t and %scheme-boolean:f instead of #f), the result of reading a Scheme file will essentially just be readable CL code...
22:27:38
aeth
And I can probably make an unholy mix of the Scheme and CL reader just for fun, i.e. supporting #t, #f, and some other Scheme things.
22:30:10
aeth
I do have a %scheme-boolean:t in case someone thinks that they're being clever. It is, of course, just CL:T.
22:31:17
aeth
Scheme needs a separate F because #f and (list) are distinct, so one of them has to be something different, and I'm certainly not going to mess with the core list data structure.
22:32:13
aeth
On the plus side, in CL, CL:NIL is usually just an ordinary symbol, so comparing to SOME-PACKAGE:F should be the same performance as comparing to CL:NIL
22:33:41
aeth
The main disadvantage is any foreign call into CL needs to be distinguished between a procedure (NIL is expected to be the empty list) and a predicate (NIL is expected to be #f)
22:34:33
phoe
aeth: the other way I can think of is that CL calls always return one or the other if native CL code returns NIL
22:34:49
aeth
I might need to write something special specifically for GETHASH, since the second value is a predicate (NIL is expected to be #f) but the primary value probably shouldn't be treated that way.
22:35:44
phoe
that would be much less seamless though, but I don't know how to make it really seamless
22:35:49
aeth
ldb: Haskell is a lazy language so it's list is a typed, lazy list. I'd implement it with a struct or maybe a lambda.
22:37:14
aeth
phoe: I mean, worst case scenario, Schemers get some extra NILs in complicated data structures.
22:38:23
phoe
or they wrap CL function calls in something that manually (if (false? cl-retval) '() cl-retval)
22:39:08
phoe
Yale Haskell - written between 1991 and 1993; was built from sources using CMU Common Lisp, Lucid Common Lisp, Allegro Common Lisp, Harlequin LispWorks, Kyoto Common Lisp. The last did suffer from performance problems, though. Compiled binaries were available for Sparc systems running SunOS 4.1.2 and Sparc 10's (sun4m) running 4.1.3. In the last release, the full functionality of X windows was made available
22:39:08
aeth
it is very weird and not at all the way I would do it, but it's understandable with the whole "27 years ago" thing
22:43:11
aeth
Yeah, the whole "I would implement it with a struct" is assuming SBCL as the main runtime that people would probably prefer, which didn't even exist at the time. As opposed to trying to run it on every possible Lisp/Scheme.
22:45:14
aeth
Implementing Haskell via the CLOS MOP is probably not the way to get a fast Haskell implementation.
7:17:05
PuercoPope
Is there any reason why compute-effective-slot-definition-class wouldn't receive the custom initargs provided. They are present in compute-direct-slot-definition afaict
7:31:41
beach
I am unable to make such corrections. I prefer to have the correct names in the question.
7:32:10
no-defun-allowed
However, the former should be given the initargs of the slot. "The initargs argument is the set of initialization arguments and values that will be passed to make-instance when the effective slot definition metaobject is created."
7:33:45
beach
Perhaps the names are correct, but specific to a particular Common Lisp implementation.
7:37:01
beach
PuercoPope: So can you rephrase the question, and could you state whether you are referring to observed behavior in some Common Lisp implementation, or to some perceived problem in the AMOP?
7:45:05
PuercoPope
I'll share the code although it is a little bit long. I am talking about observed behaviour using SBCL and sb-mop. The problem is with initializing xcb-list-slot with the correct class https://gist.github.com/PuercoPop/d13d5d663e28cd66ccb7701e50268133
7:54:18
beach
Did you create a method on compute-effective-slot-definition specialized to your new metaclass?
7:56:52
beach
I would think the default method is the one that calls effective-slot-definition-class using the initargs for standard-class then.
7:57:33
PuercoPope
No, I would expect it to call it with all the initargs. And it does so in the other cases. For example in for the padding slot
7:59:13
beach
How would the default method on compute-effective-slot-definition know what initargs your slot definition class takes?
8:00:28
PuercoPope
Why would it need to 'know' what are the initargs? Wouldn't it just pass all the options passed to the slot?
8:00:57
PuercoPope
from what I have seen, compute-effective-slot-definition is used to set the values using the direct slots, but the slot itself is always initialized using the default method, ie. (call-next-method). Although in most cases code tends to ignore initargs and just return their custom slot because they only have one
8:03:10
beach
The effective slot definition is not initialized with the same initargs as the direct slot definition. It takes initargs such as :location where the slot is stored in the instance, etc.
8:05:02
PuercoPope
And because allocation is a 'default' one it works. Makes sense. Too bad compute-effective-slot-definition-initargs doesn't seem to be exported by sb-mop
8:08:00
PuercoPope
I can use the direct-slots to chose the correct class for the effective slot instead. But I'm unsure of how to 'instanciate' the slot intself, do I just class (make-instance 'xcb-list-effective-slot-definition?)
8:09:01
PuercoPope
It is times like this that I wish the MOP would have been more fleshed out. compute-effective-slot-definition-initargs certainly seems like something that should be exposed