freenode/#lisp - IRC Chatlog
Search
2:25:13
verisimilitude
The test is separate; sure, it only runs once, but then you're caught in the idea that you can write perfect tests to test imperfect code.
2:25:45
verisimilitude
That recursion needs to be broken somewhere and the easiest place is before it starts.
2:26:55
verisimilitude
It seems strange to talk about performance like that for several reasons; firstly, it's clearly more important that the program is correct; secondly, this is Lisp and, if only performance mattered, Lisp wouldn't be chosen.
2:27:35
verisimilitude
With the ASSERT, you can even use restarts and continue; you can't do that with a test, but what if your test is wrong and fails to cover something that would only show up during actual execution over a long period of time?
3:05:28
pfdietz
Absent formal verification, testing is indispensible. And you might as well package up the tests so anyone can run them.
3:09:49
pfdietz
Delivering software of any complexity that works is very hard, and testing is not an optional part of that process.
3:13:02
verisimilitude
There's a difference between using a program to see if it works and writing however many test cases that check if something continues performing identically according to the test.
3:13:18
verisimilitude
Using a program to truly see if it works is necessary, but not this testing fad.
3:15:18
pfdietz
Casual execution of a program to "see if it works" will do f-all in a program of any complexity.
3:16:59
verisimilitude
``Beware of bugs in the above code; I have only proved it correct, not tried it.''
3:17:41
verisimilitude
Now, the funny aspect of all of these things that supposedly aren't optional is that they really are optional.
3:18:45
verisimilitude
Give a man a test and he'll know his program works. Give a man many tests and he'll never be quite certain.
3:19:16
pfdietz
Give me your code that you haven't tested, and I can be quite certain it will be shit.
3:19:59
verisimilitude
I tested this by actually running it and making sure it produced proper output in a few different cases.
3:20:14
verisimilitude
I don't need some fancy test suite to make certain a macro compiles a description correctly.
3:20:24
smokeink
check this out guys: https://www.youtube.com/watch?v=iavSKtqjVNA IOHK | Runtime Verification; Prof. Grigore Roșu CEO.
3:21:35
smokeink
"The 50 years of research and development work on K made possible what many thought couldn't be done. We can automatically generate a correct-by-structure virtual machine from it's formal specification, which is fast enough to run real programs." this is the tool in action https://www.youtube.com/watch?v=eSaIKHQOo4c
3:31:55
smokeink
Semantics-based Program Verifiers for All Languages https://www.youtube.com/watch?v=cxdPjbpn95s
3:36:15
verisimilitude
Also, pfdietz, if you actually are inspecting that code, even a tad, know that I purposefully wrote the macros to attempt to generate invalid lambda lists if my rules weren't followed.
4:08:05
White_Flame
verisimilitude: yeah, it's great that we can use runtime checks at compiletime in lisp
4:08:25
White_Flame
as opposed to having the runtime burden, or running separate sanity testing code not included in the runtime
4:10:34
pillton
verisimilitude: The unit tests aren't for you today, they are for you in six to twelve months time and they are there for your contributors to ensure they don't make the same mistakes as you did.
4:11:14
pillton
verisimilitude: Unit tests are also valuable when you are developing across multiple lisp implementations and on different platforms.
4:11:30
White_Flame
the biggest problem with unit testing is that people have no idea what a "unit" should be, and end up meaninglessly fine-grained
4:12:24
White_Flame
that, and complected design makes separating out & configuring units for testing incredibly difficult
4:15:16
White_Flame
I've always done coarser grained testing, and never once lamented not spending the time to meticulously unit test
4:15:44
aeth
Lisp is actually a good choice for if performance matters. It's not competing against fast languages like C or C++ or Java or C# (although it can be about as fast as the latter two)
4:15:58
aeth
It's competing against Ruby, Python, etc. Slow, interpreted languages for the most part.
4:16:50
aeth
White_Flame: I mostly REPL-test and run example programs. REPL-testing is perfectly fine... until you refactor. Oh well, I hope I don't introduce new bugs.
4:19:14
White_Flame
but even so, you choose when to call your testing functions. Startup your code environment, then call test functions
4:20:39
aeth
Not everything I do is currently dynamic. Some things were trivial, like for any higher ordered function using 'foo instead of #'foo
4:21:51
aeth
With the exception of an entirely CLX graphical application (which would be 2D-only?), that's basically impossible for graphical applications, although C can be minimized.
4:29:54
verisimilitude
As you can imagine, I don't have any contributors, pillton; note that in CL-ECMA-48, there is a single check to determine if the Lisp implementation meets the one nonstandard quality needed (support for a seven-bit character set) and one additional check if ASCII is supported for optimizations. Asides from this, there's no nonstandard dependencies, but checking on multiple implementations is still valuable and what I do.
4:30:53
verisimilitude
While I can understand how tests are comparable to a seatbelt, I disagree with the analogy. A seatbelt isn't going to protect you if you drive recklessly into an eighteen wheeler; you will still be destroyed, with or without the seatbelt.
4:35:34
verisimilitude
I'd think tests, at least as commonly used, are more comparable to wearing a helmet constantly.
4:36:25
verisimilitude
A helmet will protect you from a subset of truly oblivious and stupid mistakes, such as walking near a building with debris falling, so long as the debris isn't so strong to break the neck or strikes a part of the body not protected by the helmet.
4:37:05
verisimilitude
Well, you have some people writing that tests are mandatory; I'm simply challenging such an assertion.
4:39:26
verisimilitude
In closing, wearing a helmet while wearing a seatbelt is an even safer way to drive, so people should clearly do that.
4:39:46
verisimilitude
If you're going to be a professional trucker, a helmet should be mandatory; I'd fire any truck driver of mine who refused to wear a helmet.
4:44:10
pfdietz
V, out of curiosity: what's the size of the largest program you've been involved in the development and maintenance of?
4:46:56
jcowan_
I have a little plugin for the Chibi Scheme REPL; if you type @OK, it writes the previous expression and its result into a file of tests.
4:47:39
jcowan_
Also, there is a counterexample to the correctness-ueber-alles assumption, I think due to Ken Thompson but I'm not sure.
4:48:10
jcowan_
See [a large, long-running program with many bugs]? Which would prefer, eliminating 100 bugs, or making it run 100 times as fast?
4:49:59
pfdietz
The reason I ask is that a lesson you have taken from a toy example of a few hundred lines will not apply to development of a system of many thousands or millions of lines.
4:50:11
verisimilitude
Well, I try very hard to not let any of my programs get larger than one thousand lines, if I can help it; one way I do this is by looking for functionality I can split off.
4:50:40
pfdietz
In large systems, testing is vital to prevent the system from regressing as it evolves.
4:50:47
verisimilitude
I'd be inclined to believe a project encompassing millions of lines is already doomed, one way or the other.
4:51:57
verisimilitude
That sentence reminds me of the ending to ``AKIRA'', pfdietz, the idea of a system so grossly large evolving without regressions.
4:53:02
verisimilitude
While I'm not going to claim a single man couldn't understand in its entirety a program that is millions of lines long, or any length, I will write that a program that a single man doesn't understand is too big.
4:53:39
verisimilitude
If you're making changes to a program and need tests because it is so grossly large that you can't be certain you've not made bad changes, it's too large.
4:54:21
verisimilitude
I will gladly concede, pfdietz, that tests are, perhaps, necessary for development of a large program if the designers are determined that no single man should understand it in its entirety.
4:56:40
verisimilitude
So, I suppose we can agree that any redundant measures are good when lives are truly going to be at stake and when things are unnecessarily complicated.
4:57:20
verisimilitude
However, the vast majority of drivers don't wear helmets and writing tests is a waste of time and effort for the vast majority of programmers.
4:57:39
pfdietz
"Unnecessarily complicated"? Large programmings systems do things that toy program can't. You can't just say the problems they solve shouldn't be solved.
4:58:22
verisimilitude
It is usually trivial to prove a program can be smaller and simpler than it currently is, pfdietz.
4:58:59
aeth
verisimilitude: 1 million lines is almost certainly bad engineering, with few exceptions. Especially in a language like Lisp. 100,000 is definitely something you might see, though. e.g. Compiler, OS, web browser, game engine.
4:59:26
aeth
Some things just require complexity, like OS drivers or supporting media formats. Although you could probably move those all into libraries.
4:59:43
pfdietz
The real world is a messy and complex place, and real programs in that world become messy and complex things as a result. Real programs aren't large just to spite you.
4:59:48
verisimilitude
My larger point was that you should section off programs and, when known to work, seal them off so they need not be worried about again.
5:00:10
verisimilitude
You don't need tests after that point and I'd argue you don't need them before in most cases.
5:01:21
aeth
verisimilitude: Breaking certain things up into thousands of libraries actually makes the task harder because the library function has to support general use but the application function can be very specific.
5:02:05
doesthiswork1
pfdietz: I like that that statement remains true for several different definitions of entropy
5:02:14
verisimilitude
There's a world of difference from making a change to a program, compiling it, and then checking that the changes work properly and ``abs(1)=1'' or, for poor languages, ``abs(MAX_INT)=1''.
5:02:50
verisimilitude
That's true, aeth, but human judgment is supposed to intervene with things become unreasonable, one way or the other.
5:06:10
aeth
verisimilitude: It depends on if you want performance or correctness. Fortunately, in CL, you can choose between the two instead of having one chosen for you.
5:06:38
aeth
(Well, sort of. You'd have to convince the compiler it's really still a fixnum, which isn't always easy.)
5:08:24
verisimilitude
The easiest way to do this, aeth, would be to define ABS in terms of more fundamental operations, until any necessary checking is done in very few or a single place.
8:19:19
verisimilitude
"{struct termios t; tcgetattr(#0, &t); t.c_lflag |= ECHO|ICANON; tcsetattr(#0, TCSANOW, &t);}")
8:20:04
verisimilitude
With other implementations, I'm writing the same thing, but tcgetattr, tcsetattr, the constants, and other tidbits are real Lisp functions.
8:20:30
verisimilitude
A really good implementation makes the functions accept actual Lisp streams, but only Allegro does this that I'm currently aware of.
8:21:12
verisimilitude
Allegro also provides a function specifically for enabling or disabling system echoing, which is more pleasant to work with than this.
8:23:05
verisimilitude
Of course, the implementations that provide these functions that want a file descriptor instead make you get the file descriptor from the stream and they're very unreasonable about it.
8:23:52
verisimilitude
You can't get the file descriptor of a synonym stream, as an example; no, you must get the stream it uses and then get that file descriptor.
8:24:31
verisimilitude
This is just one reason to avoid nonstandard Common Lisp, most of the implementations provide horrible nonstandard APIs.
8:50:45
beach
ELS is great in that there are so many great exchanges of ideas in such a short period of time.
9:19:11
beach
I am preparing a talk for industry called "choosing a programming language". I am not pushing explicitly for Common Lisp, but I am giving several characteristics of different programming languages, and obviously, the language for which most good qualities add up is Common Lisp.
9:20:24
beach
But currently, the talk does not mention many languages, and I would like to add a list of languages for each quality that I am discussing.
9:35:46
Xof
even PHP isn't really a single-implementation language (there's a facebook variant). Perl5, maybe?
9:36:34
beach
I guess I need to distinguish between "single implementation" and "defined by a reference implementation".
9:38:28
beach
I think what I'll do is I'll work on the "slides" for the talk, and then submit them here again for comments.
9:40:25
verisimilitude
Python is effectively a single implementation language, since so much Python only works properly under it.
9:55:04
smokeink
I wouldn't call python a single implementation language , because it's split into python2 versus python3 and python2 is split into Wide and Narrow , and they're incompatible when dealing with unicode
10:00:33
Xof
TeX has multiple implementations: luaTeX is written in C, whereas regular TeX is in WEB/Pascal
10:01:10
Xof
depends what you call an implementation, I guess; is OCaml its own language, or an implementation of ML?
11:18:05
drunk_foxx[m]
Why do you consider Python a single-implementation language? It has at least 7 of them
11:28:40
makomo
oh man, today was great. first time that i showed my lisp code for a laboratory exercise to the TA :')
11:31:05
schweers
our simulation methods professor refused to grade anything that was not C, C++ or Java
11:34:50
makomo
i mean, it's ok to recognize patterns in what you do, etc., but courses like these are always do dumb and rigid somehow
11:35:01
schweers
our professor (different prof) showed us the strategy pattern (if I recall correctly) in Java and I asked him if he was serious, because it looked like Object Oriented programming in C.
11:36:16
schweers
I didn’t even use lisp to demonstrate how silly this all was, using ruby or haskell was sufficient
11:39:01
makomo
this lab was particularly fun because one of the exercises was implementing simple spreadsheet functionality
11:40:34
schweers
I find it weird that I can too get excited about stuff like that. I somehow think that this should be the most normal thing in this line of work.
11:41:32
makomo
one of the things i'm trying to do is to just convince people by example, instead of just talking about lisp and how great it is
11:43:58
schweers
it is a sad state of affairs that I prefer elisp to most mainstream languages out there
12:09:41
jcowan
"This interface implements only 10% of <random foreign library> cuz that's all I needed. YMMV."
12:23:31
sheepduke
Hey, does anyone know how does clack handle static files? (Like CSS file included in a HTML etc)
12:33:43
jcowan
often it's subtly wrong, and so people either fork it or discard it, and pretty soon everyone is effectively using their own code again
12:34:03
schweers
the more it is spread, the more value, but I would not say that just because it is not particularly widespread, that this is in and of itself a bad thing
12:34:26
schweers
I do think I see what you mean, I don’t think it is no problem at all, but I think it is blown out of proportion
12:35:48
schweers
I also wonder how this would play out if a large portion of our industry were to use (and appreciate) lisp
12:57:11
makomo
jcowan: the problem you describe is something i would attribute to lack of manpower and the size of the community
12:58:06
makomo
i'm not really sure. what other reason is there for not implementing 100% of the bindings?
13:00:07
makomo
jcowan: true i guess, but how is this connected to the fact that lisp normalizes arcane things, etc.?
13:00:46
jcowan
one of the examples from the original paper is "make C object oriented". This is so hard that it has only been done twice, and standardization on C++ and Objective-C has been fairly easy
13:01:18
jcowan
whereas "make Scheme object oriented" is a semester project, and so no OO system for Scheme has ever caught on; everyone rolls their own or does without
13:02:57
makomo
hm i see, it's not as easy to standardize on something as it is in other languages, when everyone can just invent their own
13:03:42
beach
jcowan: What is the lesson to be learned from "only half of CLOS was ever standardized"?
13:04:16
jcowan
lisp is the oldest language still in use, given that Fortran has changed almost beyond recognition
13:06:59
beach
jcowan: Furthermore, there is absolutely not reason to believe that the size of a library is proportional to the age of a language.
13:07:32
beach
jcowan: Good Common Lisp libraries would not run on LISP1.5, so they could not have been invented back then.
13:15:18
beach
jcowan: So I ask you again, what is the lesson to be learned from the fact that only half of CLOS was ever standardized?
13:16:24
beach
jcowan: Do you mean "all of it is so good that it should have been in the standard, but the people writing the standard for some reason did not do it"?
13:17:03
jcowan
makomo: I'm referring to the MOP. beach: Yes, except that it isn't "for some reason"
13:17:41
beach
jcowan: So you mean, anything invented by anybody should have been included in the standard, either fully or not at all?
13:18:53
beach
jcowan: Is it that CLOS MOP is what YOU would like to see included in the standard, so you lament the fact that it didn't happen?
13:19:17
jcowan
No, but it was part of the design from the beginning. What kept it out of the standard?
13:19:38
schweers
did MOP just come late to the party? The authors of The Art of the Metaobject Protocol seem to have CLOS sans MOP as a prerequisite
13:19:54
beach
jcowan: Oh, I can answer that. For good reasons, the committee did not find the MOP to be sufficiently well specified and the specification did not have good enough quality for the language specification.
13:20:29
beach
jcowan: The authors say something like "yeah, we know, this document is not good enough for a standard".
13:21:47
jcowan
rpg's article strongly suggests that the motives for rejecting it were rather more political than that, which makes the authors' remark quite likely to be an attempt to paper over a significant split in the community (also described by rpg)
13:22:21
beach
jcowan: OK, I now understand. YOU would have wanted the MOP to be in the standard, It isn't so now there is something wrong with the way the standard was created.
13:23:36
dim
svillemot: btw the SBCL stanza to add to ~/.sbclrc that we talked about looks like: (sb-ext:restrict-compiler-policy 'debug 3)
13:24:17
beach
jcowan: I apologize for that. I should have said something like "so the only way I can interpret your previous statement is as if YOU..."
13:35:32
tfb
jcowan: at the time CLOS was arriving in CL there were really serious worries that it could not be implemented efficiently on stock hardware. Those worries were even more serious if a MOP was added: it is a long time since I read AMOP but I am not sure it provides an answer as to how slot access can be made really fast, for instance.
13:37:02
jcowan
In general I believe the strategy to be: optimize the common case (e.g. classes whose metaclass is standard-class)
13:38:27
jcowan
Not different in principle from JIT compilation, or noticing that a generic-math procedure (like +, not in the sense of generic functions) is actually being used only to add fixnums and implementing it that way
13:42:19
tfb
Yes of course: the question is does the AMOP MOP (as it existed in 1989 or whenever the cutoff date was) let you do that portably (with the things people knew how to do in 1989 -- remember that lots of people still believed that the right answer was HW still).
13:44:17
tfb
I think the right answer was 'punt until the next standard because we need to get this thing out of the door': no-one knew there would not be a next standard for a quarter of a century!