freenode/#lisp - IRC Chatlog
Search
16:06:49
shka
Shinmera: what is the canonical way to handle errors from api (like handling incorrect user input
16:08:44
Shinmera
shka: If the error is of type api-error, then the API will automatically handle it be either outputting it as data, or redirecting back with the error GET parameter set if the browser parameter is "true"
16:13:17
Shinmera
shka: Since being able to just (error "foo") and it doing the right thing would be much more convenient
16:14:39
Shinmera
The reason I didn't do so so far is that catching all errors might leak information you don't want to leak.
16:15:52
shka
perhaps automatic logging of errors and redirecting to "Sorry, programmer is any idiot :(" page would be better
16:16:52
Shinmera
Maybe, but it still increases boilerplate a lot since it doesn't integrate well with other libraries.
16:17:18
Shinmera
So for instance if you have a thing that checks inputs or whatever for validity and uses errors, that won't automatically translate to the useful behaviour.
16:50:11
Bike
Has anyone ever used next-method-p? i have no concept of how it would be used and am curious.
16:52:56
Shinmera
Bike: https://github.com/Shinmera/qtools/blob/master/widget-convenience.lisp#L39 https://github.com/Shinmera/qtools/blob/master/examples/game/primitives.lisp#L46
16:53:31
Shinmera
Bike: Generally I find it useful if you want to do something like the append/etc method combination, but want to leave control to the method definer about whether they want to exclude superclasses or not.
16:53:36
shka
oleo: around method won't be called if you don't have primary method so what's the point?
16:55:27
oleo
clos looks for primary methods first it doesn't say there have to be primary methods in order for the rest to be looked up.....
16:57:08
oleo
and it won't call other bookkeeping stuff, so if you still want that you need the call-next-method in it
16:57:39
oleo
so before calling call-next-method you can use call-next-method-p in order to ensure there is anything to be called....
17:01:11
shka
i setfed *debugger* to nil, but then out of sudden i get messages like Handling stray condition: The variable MODULARIZE-HOOKS:NAME is unbound.
17:12:51
specbot
Built-in Method Combination Types: http://www.lispworks.com/reference/HyperSpec/Body/07_ffd.htm
17:13:07
_death
"An error is signaled if there are applicable around methods and no applicable primary methods."
17:22:17
khrbt
Xach: yes, would be good to get linedit on sharplispers. I would be happy to assist with testing and merging of patches/PRs.
17:27:27
oleo
If an around method invokes call-next-method, the next most specific around method is called, if one is applicable. If there are no around methods or if call-next-method is called by the least specific around method, the other methods are called as follows: ....
17:29:31
_death
I think there's some confusion.. if an :around method does not c-n-m, of course no next method will be called..
17:30:48
oleo
so when it has a c-n-m then it looks for a most specific :around method again, if there's none it goes to the least specific :around method and then from there to the rest of the methods
17:32:08
_death
but usually it can assume that there will be a next method, so next-method-p is not needed
17:42:04
alandipert
is anyone aware of anything like a design discussion about lisp keywords? the 'why' and history of keywords. thanks in advance for pointers
17:46:24
phoe
alandipert: keywords are just symbols that evaluate to themselves. I do not know which dialect of Lisp they originate from though. Why do you ask?
17:47:11
alandipert
i am curious about aesthetic arguments for and against them, since they're technically equivalent to quoted symbols
17:47:25
_death
phoe: that's not the whole story, of course.. the reader is also modified to make keywords convenient to use
17:48:02
Xach
Yeah, (open "foo.txt" 'direction 'output) then involves package management or string compares or deeper trickery
17:53:21
_death
alandipert: a keyword is a symbol exported from the package named "KEYWORD" that evaluates to itself.. the reader is hacked to intern keywords this way, and to accept :foo as keyword:foo
17:53:24
alandipert
Xach in what respect do you find them convenient? considering 'foo and :foo are the same number of characters to type. visual distinction, automatic package membership, combination thereof?
17:54:30
Shinmera
alandipert: You're not comparing it properly. :foo is the same as 'keyword:foo. The /point/ of keywords is that they come from one single package.
17:54:50
tfb
alandipert: if you have a lot of functions which need an 'test' keyword argument, you need a home-package for that symbol. That package could be CL, but probably should not be. So it's KEYWORD
17:56:04
_death
alandipert: you may be interested in KMP's post on "data hygiene" https://adeht.org/usenet-gems/data-hygiene.txt
17:56:20
tfb
(in fact it can't be CL because that would require you to be able to intern new symbols in CL and that would be horrible)
17:57:12
Xach
alandipert: :foo means the same thing regardless of the value of cl:*package*. Not so with 'foo.
18:00:44
alandipert
Shimera and thanks for the clarification about package origin, that seems like the key distinction. the ability to make human-readable names that are not in a package
18:04:04
tfb
strings are what languages which don't have symbols are forced to use as terrible substitutes for symbols
18:04:04
Shinmera
strings are a poor man's identifier. See almost any other language and the crutches they go through to do it like that.
18:04:28
alandipert
i'm familiar with this point of view but i'm trying to reach the next level of comprehending
18:05:04
alandipert
why are they poor identifiers? because they are typically used to represent inputs instead of names for parts of programs?
18:05:31
alandipert
i realized after typing that my inquiries are indistinguisable from trolling, so i think i will go read more stuff and report back if i find anything interesting. thanks all for the observations and pointers :-D
18:07:13
tfb
alandipert: because to compare two strings you need to compare them element-by-element, while symbol-comparison is an instruction
18:10:18
jmercouris
so I've made a macro called defcommand, effectively it is a wrapper around defun that does some other things
18:10:21
alandipert
some VMs intern strings under various circumstances. like if they're under a certain size or appear as a constant. certainly concern, but comes with a possible tradeoff
18:10:49
Colleen
jmercouris: About trivial-indent https://shinmera.github.io/trivial-indent#about_trivial-indent
18:10:53
_death
alandipert: it's generally recognized in other languages as well as that strings have "value semantics".. i.e. their identity is immaterial.. the identity of symbols is important
18:13:01
jmercouris
So i'd have to look up the slime source for a known indentation and copy/paste itin?
18:13:18
Shinmera
Well, INDENTATION is an accessor, but I don't think it'll tell you about functions not covered by trivial-indent itself.
18:14:15
_death
jmercouris: if your defcommand takes (name lambda-list &body body) then the indentation should be similar to defun by default
18:15:05
jmercouris
_death: yes, that is what my macro accepts, but for some reason indents differently
18:18:04
jmercouris
sjl: https://github.com/next-browser/next/blob/defcommand/next/source/command.lisp#L25
18:21:13
_death
jmercouris: defining that macro and indenting the defcommand form results in correct indentation here.. maybe your slime is {under|over}customized?
18:22:01
jmercouris
_death: https://github.com/jmercouris/configuration/blob/master/.emacs.d/develop/_lisp.el
18:32:38
jmercouris
completely fresh emacs after having changed slime-indentation in config: https://youtu.be/OWVyu3QDnxk
18:36:08
jasom
is there a lite version of paredit? I'm thinking one where ( adds a pair of parens and ) jumps to the next closing one only; I have my own solutions for slurp/barf that I prefer.
18:36:19
jmercouris
anyways, (common-lisp-getindentation) results in "Symbols function definition is void"
18:44:28
_death
jmercouris: the result is 4.. the elisp repl just adds a bunch of "helpful" interpretations
18:45:58
_death
it's just notation to denote an integer in different bases.. 0x is the C way, #x is the Lisp way
18:49:32
_death
jmercouris: in elisp, you just take it as two tokens.. <#o><4>.. in Common Lisp, # is a dispatching macro character and o is a sub-char for octal
18:51:19
pjb
_death: the ascii code 4 is not a character code, it's a control code. There's no ascii character with that code. The only code corresponding to ascii characters are 32 to 126.
18:51:43
jmercouris
If you are curious, here is the info about that buffer: https://gist.github.com/cdfcafa5281a0d20daaee01d4ae3a741
18:53:35
pjb
_death: it's a question of terminology and definition, and furthermore that's defined in international standards.
18:54:45
_death
pjb: in elisp, ? is used to designate a character.. so it's also a character in emacs terminology (?\C-d)
18:55:28
_death
pjb: but I don't think I ever actually read the ASCII standard.. maybe that will change how I perceive it :)
18:55:31
pjb
(unless you do something like; typedef struct { int code ; const char* name; /* … *. } character_t;
18:57:16
pjb
THat happens to have a name and perhaps a code matching the ASCII CONTROL CODE named EOT.
18:59:14
pjb
_death: ascii defines two mapping: one from some codes to control functions, and one from some other codes to characters.
18:59:47
pjb
#+#.(cl:if (cl:and (cl:and (cl:read-from-string "#\\eot") (cl:eql 4 (cl:char-code (cl:read-from-string "#\\eot"))))) '(:and) '(:or)) (list #\eot)
18:59:53
jmercouris
I'm not myself supremely interested in the intricacies of what is a control char vs a real char, so I am just curious as to why
19:00:15
pjb
jmercouris: depends if you want your software to break soon or to go on running after you're dead.
19:00:29
jmercouris
pjb: Well sure, I care about the quality of my software, and that's why I'm always eager to learn
19:00:31
_death
jmercouris: generally I dislike them.. but in this case I may be prompted to read the ascii standard ;)
19:00:57
jmercouris
pjb: so, is your answer therefore "no, not really, but I'd like to write reliable software"?
19:01:10
pjb
jmercouris: there are formal definition. If you don't know them, your code will be approximative, and it will break sooner than later.
19:01:48
jmercouris
pjb: Do you, or do you not enjoy, for non-practical reaasons, the intricacies of the difference between chars and control code chars
19:02:14
jmercouris
So it is not that you enjoy characters, but rather that they annoy you and you have set the record straight?
19:02:15
pjb
It's not that I enjoy it, it is, that's it. Like the difference between bosons and leptons.
19:02:44
_death
pjb: now, what your code checks is that the character is designated as #\Eot rather than #\End-of-Transmission or #\Stop-It or whatever... I agree that there's no name defined in CL for this character
19:03:12
pjb
_death: indeed, since it's not a standard name, and even not a semi-standard one like #\tab, it is arbitary.
19:03:32
_death
pjb: but CL implementation that assumes ASCII will have (code-char 4) evaluate to a Lisp character that should mean end of transmission, per the ASCII standard
19:03:50
beach
dfsadsfasdf: Do you mean, given a particular string and a particular character, determine whether that character is in the string?
19:04:02
pjb
It would be better, if you need to work with ASCII control codes, to start with (defconstant +eot+ 4), and use (if (code-char +eot+) (format character-stream "foo~C" (code-char +eot+)) (write-byte +eot+ binary-stream))
19:04:14
jmercouris
dfsadsfasdf: (find #\t "The Hyperspec contains approximately 110,000 hyperlinks." :test #'equal)
19:05:55
pjb
dfsadsfasdf: if you want simple, you write it yourself: (defun in (char-designator string-designator) (position (character char-designator) (string string-designator)))
19:07:01
jmercouris
dfsadsfasdf: I'm also a python developer, so if you wish to frame some questions in python terms, I can help, kind of, I'm still quite new to lisp myself
19:07:03
pjb
dfsadsfasdf: the point of using sexps, besides the macros (which were invented 4 years after the sexps), is that they allow you to write operators and functions that merge smoothly in the flow of lisp syntax.
19:07:26
pjb
_death: well, already if you have to work with control codes, you should work on binary streams, not on character streams…
19:10:21
_death
pjb: I tend to agree, but I wouldn't see it as disasterous to use characters (i.e. (defconstant eot (code-char 4)) and work with that) if you assume an ASCII-based implementation will be used
19:11:07
jmercouris
pjb: Why for example, would we not look at char arrays, and to find last character iterate byte by byte till we find the control character for the end?
19:11:15
pjb
_death: 1- (code-char 4) may return nil, even if the implementation supports an ascii external-format.
19:12:08
_death
pjb: you're saying it may return nil because you don't see it as a character.. which again points to the need to read the ASCII standard I guess
19:12:39
pjb
jmercouris: there's no binary data in lisp. There are integers, and there's the subtype bit = (member 0 1) so you could say that this is binary. But there is the notion of binary stream which is streams of bytes which are subtypes of integer.
19:13:05
pjb
And there are character streams, and a serializer/deserializer to convert between (some) lisp objects and character streams.
19:13:42
jmercouris
wouldn't a binary stream be a stream of bits, since you said that bytes don't exist?
19:14:01
pjb
Basically, if you read and memorized the clhs, those discussions would mostly disappear.
19:14:02
_death
pjb: yes, but I already qualified with the assumption of an "ascii-based implementation".. a fuzzy term that can be used to win an argument :)
19:14:47
pjb
_death: what's defined is that there may be an external format that may use the ascii code to encode the cl standard characters.
19:15:08
Bike
maybe han unification can be involved here too somehow. just imagine the possibilities.
19:15:17
jmercouris
importance of course being an arbitrary measure, so what is important to me may not be important to you etc
19:15:41
_death
pjb: ok.. I will (re?)read the cliki page, and the ascii standard.. maybe this weekend
19:15:42
pjb
_death: so if you say something that doesn't exist such as "ascii-based implementation" I hear an "implementation that has an external format using the ascii encoding". And this doesn't imply that the internal char-code/code-char uses the ascii coding system.
19:16:22
pjb
jmercouris: indeed, you can use :element-type 'bit and read and write bit by bit. But it's also able to read and wites bytes of more than one bit.
19:17:30
pjb
Hey, again today, I hear they overestimated the cost of a railways, because they confused miles and km!
19:17:34
jmercouris
Okay, so what is the big issue here? that ascii is not being used internally, and therefore a control code may appear erroneously as a character if coerced to a char?
19:19:24
jmercouris
_death: What is the implication of your sentence? I don't understand the complete meaning
19:19:51
jmercouris
are you saying the definition of a bit by which I operate is a simplification of something more complex?
19:20:12
pjb
jmercouris: the big issue is that of conformance (and portability). The point here is that we cannot make the assumption that (code-char 4) will return anything related to the ASCII control code 4, and that after (with-open-file (ascii-stream "foo" :element-type 'character :external-format *ascii-external-format* :direction :output :if-does-not-exist :supersede) (princ (code-char 4) ascii-stream)) there's: no guarantee that the b
19:21:18
pjb
jmercouris: in information theory, bit is the unit of information. A lisp bit may contain more or less than one bit of information.
19:22:27
pjb
jmercouris: for example, if we consider: 4*1000 and I tell you that I got a bit valued 0 from that bit-vector, you get 3/4 bit of information about the position of that bit, since you can exclude the position 0 for this bit 0.
19:22:52
Bike
an intuitive way to think of it is, say you have a fair coin and flip it. the information about which way it landed is obviously a bit's worth. but what if the coin is weighted, so that it lands on heads more often? intuitively, there is some amount of informing going on if i tell you it landed heads, but less than a bit.
19:23:30
pjb
If you live in a place where the sky is blue 90% of the time, and grey 10% of the time (during the day), if you ask "Is the sky blue?" and I answer you "yes", you don't get 1 bit of information, but only 0.1 bit.
19:24:03
jmercouris
how did I not get a full bit of information? I was interested in the state, 2 possibilities, I got one of them
19:25:21
pjb
Bremermann's limit = 2e50 bit/kg/s ; in a human brain: 1e18 bit/kg/s ; there's some margin…
19:25:38
pjb
Bremermann's Limit is the maximum computational speed of a self-contained system in the material universe.
19:26:34
pjb
Well, it's still quite frightnening: it means that there's no physical impossibility for an artificial (or even natural) intelligence that is astronomically smarter than us.
19:27:24
pjb
jmercouris: yes, but since the states are not equiprobable, the 1 bit of data didn't convey 1 bit of information. You learned less, because the bit of data just confirmed what was the most probable.
19:27:31
jmercouris
are you afraid that this potentially superbeing would turn your life into pure suffering or something?
19:28:12
jmercouris
I think with time we are nicer to animals, in the future I predict more niceness
19:28:20
pjb
jmercouris: yes, basically it's the Vogon problem. They just decide to build a hypergalactic highway bypass over the Solar system…
19:28:46
pjb
We're nice to animals, but when you build a highway, we don't care about the ants and worms destroyed…
19:29:19
jmercouris
jackdaniel: Okay, so you are arguing that, in the past, humans behaved nicer to animals?
19:29:20
pjb
We cannot generalize, it's a question of civilization and different people have different levels of civilization.
19:31:15
jmercouris
at any rate, read at your own leisure and reply later, best of luck catching up with work
19:31:52
jmercouris
jackdaniel: I'm not sure what I did to give you this opinion of myself, but, I apologize
19:33:05
jackdaniel
you seem to assert I have some particular opinion here – I'm just saying that I'm not interesting in defending my point
19:33:44
jmercouris
it's okay to feel this way about me, I am just letting you know, if at any point I bothered you, I did not mean so
19:51:34
shrdlu68
1.7 bits sounds like a measure of entropy. I doubt jmercouris is simplifying anything.
20:47:01
shka
doing this naive way, gives me Value #<SIMPLE-DATE:DATE 18-01-2018> can not be converted to an SQL literal. error
21:03:23
aeth
Looks like postgres itself can accept any format but recommends ISO 8601. https://www.postgresql.org/docs/current/static/datatype-datetime.html#DATATYPE-DATETIME-DATE-TABLE
22:42:40
Shinmera
When I update things it's typically a series of reconnects because I never seem to be able to do anything without also breaking twenty things in the process.
22:43:42
jmercouris
This is the quintissential: http://weknowmemes.com/wp-content/uploads/2012/09/my-code-doesnt-work-i-have-no-idea-why.jpg
22:43:59
Shinmera
Yeah, well, the system administrator part of me dies a little every time it happens
22:44:21
jmercouris
it's alright, you're an engineer, not a sysadmin, don't give into the devops hype
22:47:59
jmercouris
I can't think of a clever proverb, but I'm sure one day you'll hit your zero downtime goals :D
1:07:19
pfdietz
So, how DO quicklisp's systems get curated? Is there a way to tell if they're good or not?
1:08:09
jasom
pfdietz: the default distribution merely checks that they have some open-source license *and* that they build on sbcl
1:08:51
pfdietz
The problem is they can interfere with each other. Just building in isolation isn't enough.
1:13:44
jasom
pfdietz: I think asdf has made some changes to how readtables are modified; it was made less aggressive to to breaking some systems that assumed loading system X would modify the readtable as a side-effect, so I don't know what the final outcome of that was.
1:14:27
jasom
pfdietz: in general the curation is very minimal, so there is no guarantee of quality or completeness
1:15:10
Xach
Well, it does lately. I added a lot of stuff without asking at the start, to bootstrap...
1:40:52
aeth
Fortunately, most of the probable nickname collisions are libraries that do the exact same thing, probably wrapping the exact same C library.
1:46:19
pfdietz
At this point, I mostly care "does loading this system ruin my lisp session". Purely internal quality is less of a concern.
1:47:46
aeth
Without care, a modest sized application could be using dozens, which also probably means duplicated functionality (e.g. 3 JSON libraries or something)
1:52:16
aeth
pfdietz: It looks like I use "::" twice, to declare a type that's not exported and to fix a performance bug in ECL, i.e. (setf cffi::*cffi-ecl-method* :c/c++)