freenode/#lisp - IRC Chatlog
Search
11:02:10
jmercouris
the only thing that comes to mind is having another slot in my objects that corresponds to the type of object, but that seems dumb
11:04:05
jmercouris
so currently I have: (encode-json (make-instance 'event :key-code "code")) -> "{\"keyCode\":\"code\"}"
11:07:21
jmercouris
well, sounds like everyone is unanimous agreement that there can be no better engineered solution :D
11:08:12
tfb
jmercouris: I think you could have type objects (not just names of them) but you need to ship them across as names I think
11:10:40
random-nick
since you're sending it to JS code which wouldn't understand the classes anyway
11:11:16
jmercouris
random-nick: because the JS code must use the classes to determine HOW to render the data
11:12:44
random-nick
why not determine that in lisp code and only send to JS code exactly how you want it rendered
11:16:09
tfb
jmercouris: that was what I meant by the type object: the JS objects would have a type object slot, and the type object contains the information JS needs to render them. But I think those objects need to exist only on the JS side and have names, and it's the names that get shipped from the Lisp side. (So I'm agreeing with your approach I think!)
11:18:14
random-nick
jmercouris: well, I'm thinking more like having classes on the JS side whose JSON representations you send from lisp code
11:19:05
jmercouris
random-nick: Yeah, it is the same idea, just a difference of where the class definitions are stored
11:19:19
jmercouris
in any case, if you give some JSON to the JS that doesn't have a class available, it will not render
12:26:08
jmercouris
I'm getting strange behavior with a macro: https://gist.github.com/1bc275b5bfbe54cd2603331ebb76384d
12:40:31
jmercouris
I'm just saying, any time a signal is raised due to some error, I have no idea what all the things in SBCL mean
12:40:44
_death
there's no need to read the backtrace in this case.. it's enough to read the error text: The variable ATHENA::DEFINE is unbound.
12:51:15
flip214
jmercouris: don't worry, reading backtraces is one of the harder things in CS - in any language.
12:51:50
flip214
you need to know enough about all the things in use to determine which frame might be the real cause, and which ones are just noise.
12:52:39
jmercouris
flip214: Yeah, I would agree with that, I can't say I've ever been so truly enlightened in any language as to grasp immediately a backtrace
14:02:35
shka
anyway, as others pointed out, there are different strategies for implementing remove-duplicates
15:49:21
jmercouris
I'm getting an interesting stream error when I'm trying to return an image from my lisp web server: https://gist.github.com/36f339d186996b2f8c40cab099739366
15:57:48
jmercouris
or what is it? more like a buffer? excuse my ignorance, as I still don't know what streams are :\
16:02:48
eminhi
jmercouris: https://stackoverflow.com/questions/7441992/how-to-create-a-binary-stream-not-a-file-in-common-lisp
16:04:31
tfb
I'm the wrong person to answer this but traditionally streams either deal with (a subtype of) character, or (a subtype of) integer. And CL-the-standard is missing some stuff around this I think
16:07:21
tfb
Somewhere there is stuff (also not in the standard) about bivalant sreams which are streams which can contain both characters and bytes, and which I think you really kind of need for webby stuff
16:08:30
eminhi
tfb: we can use *open* with different :element-type, when finer control over stream is needed
16:08:33
tfb
(and. doh, flexi-streams is 'Flexible bivalent streams for Common Lisp': I should have looked at it!)
17:56:58
jasom
skidd0: If nobody mentioned it, EXIT should not be in the CL package, so if you don't use CL-USER there should be no conflict...
17:58:31
jasom
cl-user is an implementation-defined superset of the CL package; it has non-portable but useful things (most implementations define QUIT for example; SBCL defined EXIT in addition to QUIT because they changed the interface IIRC)
18:05:40
skidd0
the general user story is "I want to add a task." > "I execute 'to-do-binary --add-task'"
18:06:10
skidd0
which, in code would then open a connection (since the binary doesn't live in memory and thus can't maintain an open connection)
18:07:09
skidd0
so in my understanding, every db op (like add-task) would need to be wrapped in the with-connection
19:47:47
jasom
skidd0: that is correct. I would recommend doing a with-connection around your main function though (assuming *most* invocations of your program will need to connect to the database).
19:48:51
skidd0
well the "main" function that the end-user interacts with is a cli function with CLON
19:49:48
jasom
skidd0: assuming the commands are functions, just put it in the body of those functions.
19:50:17
jasom
I'm just suggesting you not do (with-connection <lookup some data>) (with-connection <modify some data>) ... or something stupid like that
19:51:38
skidd0
and for each command line option from clon, have a with-connection at the start of that commands function body
19:52:36
skidd0
so i'm thinking it'd be better to wrap each of the functions in the to-do package rather than the functions in the cli