freenode/#lisp - IRC Chatlog
Search
0:42:26
fiddlerwoaroof
I've done a bit of Haskell and work with people who write production Haskell apps
0:42:46
stylewarning
I ask because I'm wondering what folks would find convenient as an interoperable representation in Lisp.
0:43:45
stylewarning
in the sense that if you were to define an ADT in, say, Haskell, and you wanted to work with a representation of that in Lisp
0:45:28
fiddlerwoaroof
I personally prefer subclassing to model the things that Haskell/etc. uses ADTs for
0:46:13
fiddlerwoaroof
Because Haskell is built around a "closed world" assumption: its type system assumes that all the relevant types are known at compile-time
0:47:52
stylewarning
Bike: that's what I do in CL-ADT, but it has been inconvenient for re-definition, and inconvenient for creating constants
0:48:17
White_Flame
instead of symbols and simple-vectors, if you used symbol and cons type specifiers, along with OR or MEMBER types, wouldn't that cover most the bases?
0:49:04
stylewarning
Bike: Well it's not so bad, but I haven't been able to guarantee EQ-constness with structs
0:49:25
White_Flame
the most glaring (and recurring) problem with simple-vectors is that their element type is locked to T
0:50:17
fiddlerwoaroof
e.g. make None a singleton and return the single value whenever a None is constructed?
0:50:36
stylewarning
anyway the reason I ask is because i finally decided to cut all the nonsense out and take the plunge of implementing a strictly typed DSL in lisp with a focus on interoperability/incremental development
0:51:03
stylewarning
but I guess I don't know well enough all the nuance about compile-time load-time etc etc
0:53:16
stylewarning
fiddlerwoaroof: my motivation isn't really to implement a whole new language; it's more to allow one to write statically typed and statically inferred pieces of Lisp code, in a way that isn't completely hermetically sealed off from the rest of your lisp program
0:53:37
stylewarning
(e.g., to allow one to write safety-critical portions of their lisp programs in this DSL)
0:54:05
fiddlerwoaroof
Yeah, I've been wanting that too. But the main benefit of types, for me at least, is _not_ the correctness guarantees
0:54:46
fiddlerwoaroof
It's that, in a language with bidirectional type inference, you can use the types as a way to do some kinds of metaprogramming that is impossible with macros
0:55:38
stylewarning
for me, where a lot of my job is writing compilers, the safety is what i care about a lot, because compilers are big and complicated and bugs are hard to find
0:56:49
stylewarning
anyway, I have code here. It's not really functional. Maybe another weekend or two it will be a good enough MVP. Type inference works, type definitions almost work, compilation almost works, etc. https://github.com/tarballs-are-good/coalton
0:58:20
stylewarning
you can see some pedestrian examples of what does work now here: https://www.irccloud.com/pastebin/2CzwH3Iw/
1:01:56
fiddlerwoaroof
The Type Systems as Macros paper that hackett is based on is the most interesting one to me because it seems to lead to an interesting part of the design space
1:02:29
LdBeth
fiddlerwoaroof (IRC): Then the book Partial Evaluation and Automatic Program Generation is a good start
1:02:33
fiddlerwoaroof
Where, since macroexpansion and type checking are interleaved, you can do interesting code-generation things
1:03:07
stylewarning
idk, maybe. I think there's a lot of pay dirt in thinking about things with a very Common Lispy philosophy of building something useful and practical even if a bit muddy, instead of some new-fangled philosophy of program construction.
1:04:50
fiddlerwoaroof
But, if you think of a typechecker as a program that reads your code and transforms it (at least by erasing your types), it makes sense to implement it as part of the macroexpansion phase of your program
1:09:26
fiddlerwoaroof
Yeah, the relevant thing there is that it's all about proving that certain rewrites of a program don't change the semantics
1:15:42
fiddlerwoaroof
Anyways, there's way to many interesting things in Computer Science for the amount of free time I have
1:43:22
asarch
What's wrong with this compilation of SBCL in OpenBSD 6.4 for AMD64 (you have to enable the 'thread' flag in order to use McCLIM):
1:54:43
fiddlerwoaroof
One strategy that might work is download a binary of sbcl from http://www.sbcl.org/platform-table.html and then use that to build the version you want
1:56:51
fiddlerwoaroof
I clone the git repo, checkout the tag for the release I want and then do ./make.sh --fancy --prefix=$HOME/sbcl
1:57:54
fiddlerwoaroof
If you're using the binary distro, I think you need to also specify the --xc-host option, so that would look something like ./make.sh --fancy --prefix=$HOME/sbcl --xc-host=/path/to/binary/edition/run-sbcl.sh
1:58:54
fiddlerwoaroof
But, also, OpenBSD is probably a less-used platform so you're likely to find bugs
2:02:27
asarch
I'm planning to port those games from the YouTube video to Common Lisp using McCLIM (I hope at least I could one of them)
2:30:38
stylewarning
stuff that's working in Coalton https://github.com/tarballs-are-good/coalton#examples
2:49:26
adlai
dorketch: even in #clnoobs they're not gonna take kindly to multiline pastes of not understanding how the reader works.
3:05:37
pillton
stylewarning: I thought he wrote a CL in CL which was type safe. I remember something about a type safe Tcl/Tk binding.
3:14:55
pillton
stylewarning: Well, I have exceeded my time to try and find out. My memory might be failing.
3:37:59
fiddlerwoaroof
Yeah, I think there's this cultural thing that makes it so that most people are uninterested in static/dynamic interop
3:38:30
stylewarning
fiddlerwoaroof: I don't think that's true. The thing with Shen/Qi is that they're presented as a "all or nothing" solutions.
3:39:55
fiddlerwoaroof
Anyways, I've heard that Shen has pretty good interop with its host implementation
3:40:46
stylewarning
fiddlerwoaroof: Shen compiles to Lisp (or whatever host), but it doesn't appear to be *designed* to interoperate.
3:41:04
stylewarning
In the sense that the expectation is that you use Shen and the host in a mixed fashion. But I might be wrong.
4:23:06
beach
Maybe here is the answer: http://www.chiark.greenend.org.uk/doc/sbcl-doc/html/sbcl-internals/Type-tags.html
4:26:24
beach
Unless you are working on SBCL internals, you should not have to think about tags at all.
4:27:37
anniepoo
I'm writing (cleaning up) a tool to strip out a bunch of info after compilation, to deliver a minimal size runtime object file
4:30:00
beach
A great opportunity to get back into the game. Things have changed a lot since then. Not the language, but things around it.
4:30:25
beach
Even the programming style conventions change slowly over time, just like natural languages do.
4:32:15
beach
And we have (somewhat) better tools for free implementations. Genera, of course, was a lot better than what we have now.
4:32:47
aeth
stylewarning, fiddlerwoaroof: Personally, I would just use type declarations (and related type things) to mix "static" with CL. It works very well with SBCL (with safety above 0) except for :type in slots in defclass, which are only checked with (debug 2) (I think it's when the defclass is *defined* within a (debug 2)). There are some issues here or there with other implementations, but I will document them some day and hopefully those can
4:33:09
loke`
beach: I think it's more precise to say that is was better in some respects. Not everything has gone backwards :-)
4:33:31
stylewarning
aeth: I highly disagree. That requires monomorphising all data structures, and even Common Lisp is happy to have polymorphism everywhere.
4:34:36
stylewarning
aeth: But even so, ignoring that (major) aspect, it also requires heavy declare/check-type discipline, which is fine, but it gets difficult to precisely express the types you want to express without descending into a bunch of SATISFIES types. How do you express a list of symbols, in Lisp?
4:34:44
anniepoo
I know most of the fp basics- I wrote Lisp for Apple years ago. I know clojure and I'm a Prolog maven. But yeah, everything seems to have changed.
4:35:23
aeth
stylewarning: You can use https://github.com/Bike/introspect-environment directly or use something that uses introspect-environment, but unfortunately those only have access to *declarations* and not what the implementation's type inference system infers.
4:35:36
beach
anniepoo: So one thing that has changed is that more Common Lisp programs are object-oriented these days. Using CLOS, of course.
4:35:48
stylewarning
aeth: How do you express that a variable should be bound to a value which is a list of symbols?
4:36:45
beach
stylewarning: You can use regular type expressions developed by Jim Newton and Didier Verna.
4:37:17
aeth
stylewarning: The weakness is data structures, but there are ways around it. There actually is a type syntax for cons cells, but afaik it probably is O(n). What I did was define a struct that has foo as a foo-car and itself or nil as the foo-cdr (an alternative could permit trees at the cost of not being able to O(1) check that it's a proper list)
4:38:33
stylewarning
Lisp can express a huge variety of data structures, like lists of symbols, for example.
4:38:40
anniepoo
IIRC the first time I ran into keywords :foo was when I started clojure. I don't remember them from whatever ancient version of lisp I was using at apple
4:39:41
aeth
stylewarning: :type in struct slots tends to be respected, and works very well in SBCL. But now you're mostly stuck with structs and functions/lambdas/lets. And you don't really have a good way to deal with ftypes, even in SBCL.
4:41:52
stylewarning
aeth: I think you're still overestimating the compile-time safety afforded by type annotations with SBCL for a project like building a compiler. :)
4:42:15
anniepoo
it was an internal tool for Apple - maintaining fonts was painful, I wrote a font compiler-decompiler that turned them back and forth into s-expressions
4:43:26
aeth
stylewarning: SBCL will statically type check within a compilation unit or file, and if you turn on sb-ext:*derive-function-types* (off by default because it violates the standard) it will assume that ftypes will not change even if the function is redefined and will do even more static type checking. You might have seen the former before if you redefine a function with C-c C-c and SBCL gives a type error.
4:44:00
fiddlerwoaroof
anniepoo: (don't answer if you don't want to connect identities) but, were you the run offering the prolog course on twitter?
4:46:02
anniepoo
https://cutebouncingbunnies.wordpress.com/2017/04/25/the-standard-sequence-for-prolog/
4:46:08
fiddlerwoaroof
cool, I wanted to participate, but I was too busy moving/etc. to actually do anything
4:46:31
anniepoo
send an email to anne@swi-prolog.org saying you want to be informed next time it's offered
4:46:59
aeth
stylewarning: Anyway, I don't think what's there for types is satisfactory, but it's something that hopefully will be extended in the future, particularly with non-T data structures (when I write in this style I'm basically stuck with structs and my custom metaclass), generics, and ftypes.
4:47:25
loke`
LdBeth: I downloaded Pharo and then found soem online tutorials. That's how I started looking at ST
4:49:34
fiddlerwoaroof
aeth: that's good for performance critical code but it's effectively turning Common Lisp into Pascal or Java 1.1
4:50:36
fiddlerwoaroof
The things that make Common Lisp pleasant are things like generic functions, clos and various other higher-order techniques
4:51:57
fiddlerwoaroof
(at least, CLOS and generic functions and the condition/restart system are the main reasons why it's my favorite language)
4:53:58
stylewarning
If the claim is that adding strong type decls turns parts of your program into Pascal-y code, then I agree.
4:54:44
fiddlerwoaroof
If we had a good polymorphic-type DSL, I'd never consider using anything else
4:54:45
aeth
stylewarning: Pascal-y code, but not Pascal code, because you can have length (*) not just length (0), (1), (2), ... :-)
4:58:18
aeth
fiddlerwoaroof: This is the sort of problem that would have to be solved at the implementation-level. And several implementations since CLers hate unportable code.
4:59:26
fiddlerwoaroof
You can't really get the sort of type system I want without implementing a new language anyways.
5:00:00
fiddlerwoaroof
The important thing is that it be designed, like Clojure, as a hosted language with nice interop with the host language.
5:19:42
LdBeth
This great slides makes me question about do dynamic/static type really differentiate
5:20:56
fiddlerwoaroof
alternatively you could use this: https://github.com/TeamSPoon/wam_common_lisp/ anniepoo
5:37:14
loke`
no-defun-allowed: Maxima is weird in a different way. It's what you get for being a 40 year old code pase, origianlly written in maclisp
5:40:12
loke`
That's my CLIM UI that uses Maxima to perform computation, and uses CLIM to render the maths
5:49:30
stylewarning
No, I’d love for it to. My own “syntax” is barely syntax. It’s just typesetting object construction.
5:50:06
loke`
stylewarning: My renderer uses Maxima's syntax internally. You could probably easily write a converter that makes it supprot it.
5:50:46
stylewarning
My bigger priority re Maxima is to get my perm group algebra library included and supported
6:12:44
LeoLiang
@no-defun-allowed I familiar with javascript. Compared to lisp, javascript's eval is too simple. It change lisp's quote to string value. like Function.toString. Am I right?
6:15:19
beach
LeoLiang: This channel is about Common Lisp, so you may not get good answers about JavaScript.
6:16:41
beach
LeoLiang: In a homoiconic language, you need to distinguish between code and data, hence the quote. Plus, in Lisp, if you know the beginning of an expression, you also know the end, so you only need a single marker for a quotation.
6:19:33
LdBeth
so lisp maintains a relation table for mapping symbol's literate string to pointer, and add a new entry when encounterd a new symbol
7:03:13
on_ion
i am not sure. but i always see the upper and lower quote as 'switch flipping', and knowing the end of sexp makes the sense of it. pardon my englishes
8:28:59
no-defun-allowed
it still shows up, but both arrows are emboldened, presumably cause it scans for ===> from the left and <=== from the right and the lambda list isn't escaped in any way
8:36:32
no-defun-allowed
it seems to me like passing the sexp instead of a string representation would be less painful