freenode/lisp - IRC Chatlog
Search
8:12:55
marcopersson
How come (typep #(1 2) '(vector string)) return t? It seems like typep ignores the element type?
8:18:28
beach
"only those vectors are included whose actual array element type is the result of upgrading element type"
8:20:33
beach
... meaning SBCL does not have a specialized array type for strings, which is not surprising.
8:25:03
marcopersson
I think so.. So the type specifier is this case isn't so much about the contents of the vector, as it is about the representation, and since this is not a specialized vector, the element type in this case doesn't really matter because of that?
8:25:53
beach
Right, the type of an array is not directly related to its contents. It has to do with how it is represented.
8:34:02
marcopersson
Okay, so if I can only get type checking (from SBCL) of array element-types if SBCL support that specialization
8:36:32
beach
Nothing prevents you from wrapping (SETF AREF) in something that will check the type, though.
8:38:13
beach
Wrapping would be a good idea anyway, since your array most likely represents some application data type, so you would want to hide the fact that you are using an array to represent that data type.
8:44:47
marcopersson
Hmm, does it then even make sense to (declare (type)) vectors' and arrays' element types if they're not specialized? I assume then that SBCLcan't take advantage of that extra information for optimization when it's not actually guarranteed from the representation
8:45:12
beach
Like for example, if your vector represents a graph, you would want an abstraction such as ADD-VERTEX, hiding the fact that the graph is represented as a vector. It is then natural to check that a vertex was given.
8:46:36
beach
It doesn't make sense. The standard says that declaring a type is the same as wrapping all references to the variable in THE.
8:47:25
beach
So, if the type is not a specialized array, then it will check that the array has element-type T.
8:51:56
beach
Otherwise, you will end up writing a lot of declarations that you will often change later.
8:53:05
beach
That's one of the problems with statically typed languages. They force you to provide information that often does not remain true for very long.
8:53:31
marcopersson
Yeah, I shouldn't really be focusing on it at all, since this is just a prototype, and I won't be allowed to write the final product in CL anyway. I just ended up playing with types, and just got suprised by the whole (typep #(1 2) '(vector string)) thing and wanted to know more
8:54:10
beach
If you really want to do that kind of stuff, define application types with DEFTYPE and use those types. Then there is only one place to modify later on.
8:56:38
marcopersson
Good advice, thanks. And yeah I won't have any luck convincing C#/C++ programmers at my comp. to start a production CL project, so C# it is..
9:03:41
beach
Trying to convince won't work. Showing what you can do, presumable faster than your colleagues might.
9:05:43
marcopersson
Yeah, the problem then becomes "What about when you leave?", the whole finding developers/maintenance spiel
9:06:08
beach
Do your colleagues know that it is impossible to write a C++ program that is both modular and fast?
9:07:45
beach
If they did, they would notice that training people is less costly than the loss of productivity working with inferior tools.
9:13:13
marcopersson
For this project specifically writing it in C# does give the advantage that it becomes a 1st class citizen in the runtime that is the subject of the program
13:21:37
jcowan
I figure that uninterned symbols ("gensyms" for short) have three distinguishing properties: 1) they are never eq to anything else; 2) they are not read-print invariant; 3) they can be freely garbage collected even when interned symbols cannot be.
15:25:04
jcowan
dlowe: That's what I was thinking. So you can approach property 1 as a limit by using ordinary symbols long statistically-random symbol-names instead of gensyms, at the expense of property 2.
18:26:28
reaper
Looking around for cross platform GUI libraries, I find the most of them are outdated or not maintained
18:28:40
Xach
If your main goal is to learn CL so you can use free, portable, nice GUI tools, you will have to write those tools.
18:30:52
reaper
I had tried to use CL a few years back and coming back to it. My main goal was to try build an editor and I thought that it would be good learning project for CL
18:31:21
Xach
reaper: I think the state of reusable tools in that domain would be pretty frustrating as a first learning project.
18:31:52
Xach
I think it's difficult to write because there are a lot of details to get right to get something useful.
18:32:35
dlowe
I hacked up an inventory control system for the company I worked for many years ago, and it was quite easy
18:33:49
dlowe
I agree that if you're sticking with the open source software, cross-platform GUI is not really a thing people work on
18:35:16
Xach
reaper: maybe! you know, maybe i'm selling the qt stuff short. there are qt libraries already made that you could try to reuse.
18:38:36
reaper
personal opinion, I just downloaded lisp work and it looks weird (coming from IntelliJ, Eclipse background)
18:43:19
ck_
I agree that the gui looks a little foreign, that put me off too. But because the job used Allegro, I didn't look long
18:45:48
ck_
I know I'd like a smaller environment to learn a new language -- might be personal opinion though
18:46:13
Guest5703
ck_: thinking of low-hanging fruit or make test cases, those could have learning potential.