freenode/#lisp - IRC Chatlog
Search
12:47:11
godratio
still not for sure how lisp llikes their enums but this code is not so lispy but its how a c person writs lisp but still works and getting the hang of it.
12:48:51
godratio
regarding the (defvar token_cfg_doubledash ‘doubledash) yeah i will chagne that first t
12:49:53
godratio
is that a good way tho? i mdan is like my enums but is there a better way more explicit way of doing that. from what i read this is good enough since lisp asigns uniqueid to every symbol
12:51:14
Bike
well, use defparameter instead of defvar i guess. (defparameter foo bar) is just the same as (progn (defvar foo) (setf foo bar))
12:52:54
godratio
ohh ok cool good to know I will do it that way instead and just namespace with naming conventions.
12:53:48
Bike
though speaking of names, you're not following the conventions. dynamic variables (like you declare with defvar/parameter) are named with *asterisks*. multi word identifiers are split up like-this, not LikeThis.
12:53:51
godratio
I was doing at-char for the loop variables but i thinkn for lisp programmers at-cons tehn in the inner loop at-string-cons made more descriptive sense
12:55:04
godratio
ok i see but the token_dash etc… are just being used as enums not global vars thats why i left out the asterix there.
12:55:52
Bike
well, usually you wouldn't even have "enums". you'd just put 'doubledash in the code. it's not like they're opaque numbers like you'd do in C.
12:56:51
godratio
you mean no need to defvars at all? just slam in ‘doubledash wherever i do equality checks?
12:59:37
Bike
You get an error when you have like (cond ((char= #- (first at-cons)) (push ...) (return at-cons)) ...)?
13:04:28
godratio
ok one sec i see where your saying in the docs it says that it should be an implicit progn but still getting a compile error one sec
13:06:32
godratio
https://github.com/godratio/lisptools/blob/5b8b71e952c05e9c980a210167b5b34a8da8ad22/test.lisp#L93
13:11:44
godratio
ahaa ok i see it implicit progn as the whole enclocing form i was confused hehe got it
13:12:24
godratio
The whole form is a implicit prog not just the second parameter which is what my assumption was.
13:26:46
godratio
ok so refactored giving your suggestions one thing i can say is after progn is removed
13:28:32
godratio
or define anything its a bit cray although if you mis typing something could produce a very transparent bug… but than agian even if you define those things doesnt save you
13:37:41
beach
godratio: Why do you want char-count to be a special variable. You are only using it in one place, so it could be a lexical variable. In fact you don't need it at all. (dotimes i (file-length stream) ...)
13:42:05
godratio
the file read in stuff was the first lisp code ever wrote in my life haha so thats why its all messed up i just fixed basd on you suggestions all very good points.
13:42:08
beach
Why is *current-string* a special variable? It is used only in one function, so you can make it a lexical variable.
13:42:41
godratio
regarding (setf at (get-token at)) is to move the conscell forward to the point we advanced by get-token
13:43:39
godratio
well i dont see why not since it seems to move it forward from there on the next iteration by that spiffy loop macro.
13:44:26
godratio
Yes current string iw as trying to use let and it was failing for some reason i had not quite got why i could not get lexical scoping to work the way i wanted will try again to properly understand it.
13:46:23
beach
I am pretty sure it is not specified what happens if you assign to a loop variable in the body of the loop.
13:47:02
solyd
i'm having an issue with managing state / configuration in my lisp code. I've seen plenty of libraries that use global variables like ql:*local-project-directories* to do this but coming from Java/C++ background it strikes me as odd (wrong) to use global variables...
13:47:10
beach
I would try something like (loop for at = (get-token *char-list*) then (get-token at) collect at)
13:47:46
solyd
also, how would i define my functions? (defun send-x (x host port) ...) where host and port should be configured by the library user, should they not appear in the function declaration and just use *host* and *port* defined as globals?
13:49:31
solyd
beach: yes, they are package-local but I'm worried about having the program state scattered across many global variables. I like everything to be contained nicely in meaningful objects...
13:49:55
beach
solyd: You can get the best of both worlds with &optional as in (defun send-x (x &optional (host *host*) (port *port*)) ...)
13:51:44
solyd
mmmm... what about using partial functions? I can create another "layer" of functions that have most of the arguments values assigned to ease development and still have a layer that accepts all possibly required arguments to do the job
13:53:17
solyd
do you have any recommendations on high quality, production, lisp code to read so I can figure out the common best practices?
13:53:34
beach
solyd: The package can kind of play the role of a class instance when you are not expected to have multiple simultaneous instances. So special variables are fine in that case.
13:54:44
beach
solyd: This one https://github.com/robert-strandh/Cluffer is pretty recent so it follows my more recent ideas of good practice.
13:55:24
beach
solyd: You can't have several instances of one particular package. A package is already an instance. If you need to have multiple simultaneous instances, you would use classes instead.
20:11:12
jasom
Anybody know the most recent version of ASDF for which the package ASDF/PACKAGE exists as a nickname for UIOP/PACKAGE?
20:22:32
shrdlu68
Got some time to work on cl-tls. I edited a version of dexador to test with, and ran into an issue where some servers are sending records that are bigger in length than the spec allows for. Very weird.
20:41:36
fe[nl]ix
shrdlu68: have you tried extracting the conformance test suites from other ssl libraries and running them against cl-tls ?
20:44:04
shrdlu68
fe[nl]ix: Nope, apart from the openssl and gnutls command-line tools. Might you know of any?
20:49:12
shrdlu68
If I comment out the code that checks that the fragment length does not exceed the maximum fragment length it all works fine. I can see in wireshark that the records are indeed past the allowed size limit (2^14).
20:52:36
fe[nl]ix
there are two types of test suites: the ones that send ostensibly correct packetes and check the server configuration for features that are vulnerable to attacks
20:53:15
fe[nl]ix
and the ones that send incorrect packets and try to detect bugs in the protocol state machine
20:56:14
shrdlu68
I'm aware of ssllabs, I think it tests for poor configuration rather than implementation bugs.
20:58:07
shrdlu68
There are hardly more sophisticated tls test suits than fuzzers, which are, in my experience, not very effective in the case of tls/ssl.
21:01:07
fe[nl]ix
I know there are proprietary suites that were built by going through the standard and implementing a contrary test every time there's a MUST or a SHOULD
21:03:02
shrdlu68
For example, cl-tls reports that the certificate that signs microsoft.com's ocsp responses does not have the ocsp-sign bit set.
21:03:12
fe[nl]ix
setting up a business and finding the first customers might not be easy, but doable
21:04:51
shrdlu68
Another example: A bunch of ocsp responders have much longer update intervals than I had initially set as the maximum in cl-tls, forcing me to lower the standards. The spec only says the interval should be "sufficiently recent". This gives people the freedom to set update intervals that I thought no sane person would set for an ocsp responder.
21:09:45
shrdlu68
One concept I learned in writing cl-tls was "bug-compliance" and "bug-compatibility", from Peter Gutmann's blogs. When a major company misreads the specs and creates a buggy x509/tls implementation, everyone else is forced to introduce this bug as well in order to be bug-compatible with the big guys.
21:55:59
shrdlu68
How should write-byte and write-sequence behave when attempting to write to a closed stream?