freenode/#lisp - IRC Chatlog
Search
3:09:59
aeth
(setf velocity (values x y z)) is really, roughly: (setf (array-row-of-3 %velocity id) (values x y z)) where array-row-of-3 sets the first three values of a row in a 2D array when given three values... so ultimately (psetf (aref %velocity id 0) x (aref %velocity id 1) y (aref %velocity id 2) z) and quite a few things are being hidden
3:13:41
aeth
oh, and that's essentially (psetf (aref (velocity-velocity (velocity ecs)) id 0) x (aref (velocity-velocity (velocity ecs)) id 1) y (aref (velocity-velocity (velocity ecs)) id 2) z)
3:22:53
aeth
on the other hand, it reduces the maintenance to a handful of unreadable macros instead of the entire source code
3:22:55
Zhivago
If the code is as clever as you can make it, it's probably too clever for you to debug.
3:26:18
whoman
ouu interesting. i like that idea. puppet strings for a whole project, the One macro...
3:26:19
aeth
(with-selection ecs (id entity-id)\n ((velocity (velocity velocity :row-of 3)))\n (setf velocity (values x y z)))
3:26:55
aeth
A bit confusing because the name velocity is used a lot but :row-of 3 basically says it's magical like that, and even says how many values it takes
3:27:23
Zhivago
Ok, that's probably a little less horrible but, even so it seems like it would be simpler to have an obvious accessor.
3:27:47
aeth
Basically: with the selection from the ecs where id=entity-id from the table velocity bind velocity to the row-of 3 called velocity
3:27:50
fouric
Zhivago: some dude named Chad Fowler thinks that you should never modify functions, only rewrite them: https://dave.cheney.net/2017/11/30/never-edit-a-method-always-rewrite-it
3:28:18
fouric
if your unreadable, terse code needs to be modified, all aeth has to do is just rewrite it with equally unreadable, terse code that has the new functionality
3:30:00
Zhivago
fouric: But if he doesn't understand what the original does, how will he understand what the new version should do? :)
3:30:17
whoman
C/java/objc/js//make/etc i can type fast and a lot with some nice music going, its quite chill and mindless. i like how lisp and haskell and ocaml 'force' me to reflect and think, as itchy as my hands are to type.
3:30:22
aeth
Zhivago: The accessor is (velocity velocity :row-of 3) and that's the same syntax as directly using with-entity-accessors, it's just combined into the database query
3:30:57
whoman
comments or not, the compiler is still the one "doing" it. code is generally quite specific
3:30:57
aeth
Doing things this way saves a lot of repetition (and potential typo bugs) since it's both fetching velocity and accessing velocity in the same place
3:31:27
Zhivago
I'm not going to stop you from doing this -- but I will point out that as developers mature they move from fancy to boring code. There's a reason for this.
3:32:51
aeth
Zhivago: The array doesn't exist, though. The structs don't exist, either. Those are just implementation details that I want to completely hide from the user.
3:33:28
aeth
Otherwise I have to rewrite about a third of my game engine every time I change how the data is structured.
12:59:04
jackdaniel
the end of paste.lisp.org, it's not pastebin. there is plenty of other paste services
13:05:41
phoe
Make sure that the symbol you use in the SLOT-VALUE and the symbol used as the slot name are EQ.
13:06:38
phoe
francogrex: https://stackoverflow.com/questions/40742048/is-there-a-way-to-get-the-slots-of-a-class
13:13:16
random-nick
is there a pastebin service which does rainbow parentheses or parentheses highlighting?
13:17:08
jackdaniel
most do. one created by Shinmera has also CL-specific highligting: https://plaster.tymoon.eu/
13:31:43
francogrex
pastebin is the end of an era!!! it's yet another setback for common lisp... really makes me sad a little
13:46:25
pjb
The big problem with the absence of lisppaste, is that the other don't keep the history. With lisppaste, I could refer to pastes 3 or 5 year old!
13:53:51
jackdaniel
there was a discussion on mailing list about possibilities, nobody stepped in to propose that he can maintain it *and* keep it safe from spam