Search
Thursday, 27th of August 2020, 1:22:00 UTC
2:58:00
beach
Good morning everyone!
3:03:08
fe[nl]ix
good morning beach
3:14:28
PuercoPop
Was there ever a proposal for packages to use symbols?
3:15:58
PuercoPop
As their mainly, although it doesn't make sense, to what package would the symbol belong to if the package doesn't exist when the form is being read
3:16:33
beach
As the name, you mean? Yes, that would be complicated indeed.
3:17:34
PuercoPop
yeah as their name (there was supposed to be name between their and mainly :v)
3:20:11
beach
One could possibly imagine a single pre-existing package that would then be the home package for all package names.
3:23:27
PuercoPop
The keyword package could do
4:37:48
dominic35
** NICK dominic34
4:41:45
Lord_of_Life_
** NICK Lord_of_Life
10:28:23
phoe
but if they're going to be from a single package, what's the real point, then?
10:28:47
phoe
then (find-package string) becomes just (find-package (find-symbol string :keyword))
10:36:20
Josh_2
with the MOP can I create a metaclass that will add slots to my class based on the slot-value of another slot?
10:51:02
Josh_2
basically I would like to have a slot within a class with a set name like 'symbol-slots' then when I (make-instance 'special-class :symbol-slots '(a b c d e)) then I will get an instance with the slots symbol-slots a b c d and e.
10:51:52
Josh_2
so the initarg :symbol-slots would be converted to effective slots and appended to my instance
10:57:14
phoe
this sounds like a method on INITIALIZE-INSTANCE that accepts :SYMBOL-SLOTS and goes CALL-NEXT-METHOD with an appropriately frobbed :DIRECT-SLOTS argument
10:57:55
phoe
like, (defmethod initialize-instance ((class special-class) &rest args &key direct-slots &a-o-k) (call-next-method ...))
10:58:16
phoe
uh I mean &key symbol-slots
10:58:32
phoe
where in ... you remove SYMBOL-SLOTS from the ARGS plist and also pass a modified DIRECT-SLOTS argument
11:00:36
Josh_2
hmm alright I'll look into that
11:00:48
Josh_2
I thought I would have to mess with make-instance
11:01:14
phoe
you don't want to mess with ALLOCATE-INSTANCE by messing with MAKE-INSTANCE
11:01:56
phoe
all you want to do is to modify the way in which the instance is initialized, by means of stuffing more direct slot definitions in there
11:02:02
phoe
(if I understand all this correctly)
11:43:56
Josh_2
okay so I have made my new effective slots that I want to append, I just don't know how to append them in make-instance
11:51:56
Josh_2
https://plaster.tymoon.eu/view/2032#2032
12:09:27
Josh_2
maybe I can use update-instance-for-redefined-class
12:15:20
Josh_2
eh says on clhs that this is not intended to be used by programmers
12:16:01
jmercouris
then you shall make a method
12:18:54
Josh_2
"The generic function update-instance-for-redefined-class is not intended to be called by programmers."
12:18:56
_death
it's not intendede to be _called_ by users
12:20:51
jmercouris
it is it the responsibility of the implementation?
12:21:10
jmercouris
who is supposed to call it?
12:21:45
_death
when you evaluate a defclass it may get called, to update instances for redefined class
12:21:51
Josh_2
It's called when classes are redefined
12:21:54
jmercouris
so the implementation will do it
12:22:54
Josh_2
but I'm trying to add new slots to an instance of a class
12:23:11
jmercouris
Josh_2: we do exactly this in Nyxt
12:23:31
jmercouris
we ended up using another class implementation
12:23:38
jmercouris
in this case hu.dwim.xyz I can't remember what comes after dwim
12:23:57
jmercouris
https://github.com/atlas-engineer/nyxt/pull/889
12:24:30
jmercouris
https://quickref.common-lisp.net/hu.dwim.defclass-star.html
12:27:52
jmercouris
ACTION throws spaghetti at Josh_2
12:30:00
Josh_2
So It's a no go with standard defclass?
12:30:27
jmercouris
it is possible, I'm just suggesting that you may wish to go another route if you will find yourself doing things like this
12:31:15
Josh_2
Well the link to their site is dead and those docs aren't exactly accessible
12:32:24
Josh_2
I was basically just messing around and seeing if I *could* do it because I thought it would be a nice way for users to interact with request objects
12:33:06
Josh_2
instead of having to look through a list they could just set/get from a slot, a slot that is dynamically added depending on some data that is passed
12:33:40
jmercouris
a slot that is dynamically added...
12:33:43
Josh_2
it was a "hmm It's 3am and I'm laying in bed thinking about this" moment
12:34:04
jmercouris
well, it is possible to update the instances
12:34:12
jmercouris
you could also copy the values to a new instance
12:34:34
_death
sounds like work for change-class to me
12:35:01
Josh_2
well the slots would have to be appended based on the value of an initarg when calling make-instance
12:35:50
_death
assuming it's something along the lines of "state pattern"
12:36:04
jmercouris
what is 'state pattern'?
12:36:18
jmercouris
Josh_2: why use slots when you may use another data structure?
12:36:26
jmercouris
why not a linked list of properties
12:36:33
Josh_2
Yes thats what I'm doing right now
12:36:35
jmercouris
UNLESS you will specialize upon these slots
12:36:45
Josh_2
to learn more about MOP really
12:36:51
_death
https://en.wikipedia.org/wiki/State_pattern
12:38:05
Josh_2
using change-class would require creating a class based on what I have parsed
12:38:30
jmercouris
then you will want to redefine the old class
12:38:36
jmercouris
that's exactly what I linked to you in my pull request
12:38:41
jmercouris
you see, we can have (foo) extend (foo)
12:39:02
jmercouris
we replace a class in-place and change its slots etc
12:39:02
_death
if the set of properties is not fixed, then just keep a plist
12:41:29
Josh_2
I'm currently just using an alist
12:41:47
Josh_2
works just fine, but now my curiosity has peaked :P
12:42:03
jmercouris
reminds me of sneak mountain
12:42:23
jmercouris
s/sneak mountain/stealth mountain
12:42:38
jmercouris
"Stealth Mountain (@StealthMountain) is a Twitter bot with a single, simple purpose: It searches for tweets in which a person has typed the words “sneak peak” when they meant to type “sneak peek,” then publishes a reply informing the author of his error. "
12:43:31
_death
if the objective is to learn about the MOP, then I remember AMOP had an example concerning dynamic slot storage
12:44:54
Josh_2
Yes I have read that example
12:45:46
Josh_2
but they have all their slots predefined but wish to only allocate slots when needed
12:47:16
_death
I see.. well, the last time I did something with the MOP was years ago, so someone else may be of help ;)
13:13:33
jmercouris
I'm having some trouble with a macro of indeterminate length
13:13:57
jmercouris
so I am trying to define a defmacro that operates on a list
13:14:03
jmercouris
let me give an example
13:14:40
jmercouris
http://dpaste.com/2SWN6VEXF
13:14:59
jmercouris
ignore "CARP" and "SALMON"
13:15:08
jmercouris
I can't get it to splice how I want
13:15:18
phoe
wait a second though, CL:LIST is predefined
13:15:39
jmercouris
well, in this case, yes
13:15:46
jmercouris
but pretend it is a list of arbitrary length
13:15:57
jmercouris
because that is in fact what it is
13:16:00
phoe
what is the call to your macro supposed to look like pre-expansion?
13:16:15
jmercouris
so you will say something like (macroxyz source)
13:16:20
jmercouris
and it will produce the expansion
13:16:47
phoe
(macroxyz (list (a nil nil) (b nil nil)))?
13:17:14
phoe
if this is a nested list, then this requires either code walking or evaluation
13:17:28
phoe
I still don't understand what you are trying to do
13:17:30
jmercouris
it is not a nested list
13:17:35
jmercouris
I'm sorry let me make a practical example
13:17:40
jmercouris
give me one more moment
13:17:43
phoe
the CL:LIST call confuses me
13:18:13
jackdaniel
you 1) did not paste the macro itself; 2) you did not state the problem correctly
13:18:23
jackdaniel
what is it you want to splice? how does it splice?
13:18:35
jackdaniel
how do you want it to be spliced
13:18:51
phoe
let's get the communication done first and then let's discuss things
13:18:51
jackdaniel
ACTION points out that there was no answerable question stated
13:20:03
jackdaniel
and it is quite surprising given that a considerable wall of text has been written ,)
13:20:16
jmercouris
you know what is surprising to me?
13:20:21
jmercouris
how socially insensitive you are
13:20:34
phoe
heyyyyyyy jmercouris jackdaniel
13:20:37
jackdaniel
please do not attack me presonally, it is a last warning
13:21:10
phoe
calm down both of you, will you?
13:21:27
phoe
stirring this further will bring no good to either of you or to #lisp, and right now it's both of you stirring this up
Thursday, 27th of August 2020, 13:22:00 UTC