samth
2020-3-23 14:01:12

@deactivateduser60718 @mflatt would know for sure but that looks like a bug to me


mflatt
2020-3-23 14:06:51

I agree that it looks like a bug.


deactivateduser60718
2020-3-23 14:21:37

@mflatt @samth Thank you. I’ll have an issue up for you in the racket repo once I get reproduction instructions ready.


code
2020-3-23 15:13:22

@code has joined the channel


anything
2020-3-23 16:19:18

Is there a procedure to force the Racket Web Server to read the SSL certificate again? Every three months I renew my certificate as ‘Let’s Encrypt’ forces me to, but then I have to restart the server to read the SSL certificate again — as I don’t know how else to do it.


popa.bogdanp
2020-3-23 18:11:29

This is achievable if you create your own SSL TCP unit, but it’s a bunch of error-prone work. I’d recommend just running a reverse proxy like nginx in front of your Racket app to handle TLS termination since certbot integrates with it fairly well.


anything
2020-3-23 19:43:49

Cool. I’ll look into nginx. I never used it. Thanks!


deactivateduser60718
2020-3-23 19:47:16

@mflatt Second topic: I just regenerated Vulkan bindings to match updates to their spec. Racket crashes on the result due to what I assume is a bad declaration/alignment. The continuation marks do not clarify which type went wrong, and there’s about 2000 declarations to sift through. I doubt this is a bug in Racket, but any advice on what I can do to make this error more informative?

Relevant diff: https://github.com/zyrolasting/racket-vulkan/commit/26fbbf72c6ec85d824097aca684254f7c547cc28

[sage@localhost vulkan]$ racket unsafe.rkt modulo: division by zero context...: condition->exn do-raise dynamic-wind loop make-cstruct-type /home/sage/racket/collects/ffi/unsafe.rkt:32:27: _list-struct interpret [repeats 1 more time] proc call-in-empty-metacontinuation-frame body of "/home/sage/Code/vulkan/unsafe.rkt"


soegaard2
2020-3-23 19:58:20

A low tech solution is to prepend each line in unsafe.rkt with (displayln i) where i is the line number.


soegaard2
2020-3-23 20:00:29

Or insert, say, (/ 1 0) at line 1000 to see whether the error occurs before or after line 1000 (then rinse and repeat to narrow it down).


deactivateduser60718
2020-3-23 20:01:18

Got it.


samdphillips
2020-3-23 20:11:02

Redefine modulo maybe?


samdphillips
2020-3-23 20:15:39

(oh unless it’s coming from somewhere else, oops)


anything
2020-3-23 20:28:25

Life was easy on Windows. Upgrading libsqlite3 on Ubuntu, though, isn’t as easy. I tried unsuccessfully to compile https://www.sqlite.org/src/tarball/sqlite.tar.gz and I get errors. Trying other ways, I tried a precompiled library, but it was compiled against a newer libc, so I can’t install it (and if I could, it wouldn’t run!), so I might have to install a whole new system just to get a newer libsqlite3, which is crazy. The root-problem is really my inability to compile the source code. If I could build the library, it’d probably be a smooth installation.

For the record, the compilation goes like this: https://pastebin.com/raw/7NMrqMLB

There is no header missing, so I see no reason for unknown type name 'sqlite_int64'. Won’t dig into this.

Of course, I can always just write

(define (delete-by-id id) (query-exec db-conn "delete from offerings where item_id = $1" id))

and move on. :-D


samdphillips
2020-3-23 20:58:26

Are .plt files made with raco pack Racket version dependent?


greg
2020-3-23 21:23:05

@samth and others: I merged to master and it has flowed through to MELPA https://melpa.org/#/racket-mode so you may install/upgrade the usual way.


greg
2020-3-23 21:24:33

Also I just refreshed the online docs: https://www.racket-mode.com/


greg
2020-3-23 21:25:10

Posting back to main thread: I just updated Racket Mode with the check-syntax features.


mflatt
2020-3-23 21:36:48

Probably _list-struct should complain when it gets an empty list of fields, and maybe that would have helped. (The argument checking of exports from ffi/unsafe has never been as good as it should be.)


sam.halliday
2020-3-23 21:44:02

@sam.halliday has joined the channel


deactivateduser60718
2020-3-23 21:44:37

I figured there would have been an empty declaration, but did not see one via Ctrl+F. Is that the only way this error could occur?


deactivateduser60718
2020-3-23 21:45:17

Here’s the issue with a reproduction re: bulk bindings not found https://github.com/racket/racket/issues/3080


sam.halliday
2020-3-23 21:45:55

Hi all. I have downloaded the racket source code to see what it is written in and I am pleased to see that I was able to compile it with gcc! Does racket really only need a C compiler or is it hiding some bytecode from me? e.g. I was recently disappointed to learn that polyml (a standard ML impl) ships with a bunch of x86 machine code.


sam.halliday
2020-3-23 21:47:30

and does the same go for Typed Racket, can I basically go from C compiler to a working Typed Racket compiler? :heart_eyes:


popa.bogdanp
2020-3-23 21:50:43

Sweet! Thanks again for all your work on this!


soegaard2
2020-3-23 21:58:30

From https://github.com/racket/racket/blob/master/build.md

> Minimal Racket does not require additional native libraries to run, but under Windows, encoding-conversion, extflonum, and SSL functionality is hobbled until native libraries from the "racket-win32-i386" or "racket-win32-x86_64" package are installed.


soegaard2
2020-3-23 21:59:42

If I understand correctly it is possible to bootstrap Racket directly from source. So in that sense there is no hidden bytecode.


deactivateduser60718
2020-3-23 22:00:10

Ah, found it: there was a (_list-struct _void).


sam.halliday
2020-3-23 22:00:13

yup, I read those docs, and I even compiled it locally, but I’ve been burnt by other compilers that claim to be “from C” but actually end up using some mystery meat binaries under the hood.


soegaard2
2020-3-23 22:01:09

The GUI depends on a few external libraries though. Cairo, Pango and others.


sam.halliday
2020-3-23 22:01:12

is typed racket written in racket, or is it a separate compiler?


soegaard2
2020-3-23 22:01:27

Typed Racket is implemented in Racket.


sam.halliday
2020-3-23 22:01:31

oh, I am not going to be using anything except GNU Emacs… you can pry it from my cold dead hands :grimacing:


deactivateduser60718
2020-3-23 22:01:49

In that case, don’t forget to use racket-mode


sam.halliday
2020-3-23 22:02:39

well this is fantastic. I am suddenly very interested in Racket and wishing I had some free time.


sam.halliday
2020-3-23 22:03:24

the Typed Racket docs have an FAQ about how match sometimes doesn’t work, but it doesn’t have a section about when it does work… can I assume that match will give me exhaustivity checknig over union types?


soegaard2
2020-3-23 22:05:08

As far as I know (but I am no expert in Typed Racket) the answer is no - at least when it comes to the standard matcher.


soegaard2
2020-3-23 22:05:36

However I think there is a chance that someone has implemented such a datatype.


popa.bogdanp
2020-3-23 22:06:47

The conservative GC version of Racket is built from the C source, then that version of Racket (Racket CGC) is used to do some source-to-source translation of the C code to build the precise GC version of Racket (Racket 3m), but there are no binary images involved in the process.


popa.bogdanp
2020-3-23 22:07:06

(also, thank you for all your work on Ensime; I used it a lot years ago)


sam.halliday
2020-3-23 22:07:17

:blush:


sam.halliday
2020-3-23 22:08:39

thus begins the rabbit hole to implement exhaustivity checking :laughing:


soegaard2
2020-3-23 22:08:50

sam.halliday
2020-3-23 22:09:39

I’d considered the possibility of writing a macro for scheme or something that would generate union reprs and then patterm matcher macros to use for them, but that all started to sound a bit too crazy for me.


sam.halliday
2020-3-23 22:09:55

nice!


soegaard2
2020-3-23 22:09:56

The problem is what “union type” refers to. In standard untyped Racket, union types are often implicit.


soegaard2
2020-3-23 22:10:39

I am not sure, what Typed Racket offers though. But hang around the Typed Racket experts are here often.


sam.halliday
2020-3-23 22:10:44

I don’t even need this fancy guard based pattern matching, I was just looking for something that makes sure I considered all the “data constructors” (or whatever the equivalent is)


sam.halliday
2020-3-23 22:11:12

but I can probably guess that all the data constructors are really just guards in disguise, if it’s doing what I think it’s doing.


sam.halliday
2020-3-23 22:12:22

I also noticed on the main Racket Lang landing page that it is being promoted as a compiler designer’s language… has anybody considered writing a Haskell interpreter or compiler in (Typed) Racket?


sam.halliday
2020-3-23 22:12:37

that would be a real dream project for me


soegaard2
2020-3-23 22:13:47

Alexis has written Hackett.


soegaard2
2020-3-23 22:14:24

sam.halliday
2020-3-23 22:15:00

heh, yeah I seen that … it’s cool. But that’s a totally new language taking inspiration from haskell and racket. I was thinking more about a Haskell2010 compliant compiler.


sam.halliday
2020-3-23 22:16:18

(there’s also Liskell which is ghc with the lexer/parser rewritten)


lexi.lambda
2020-3-23 22:16:18

@sam.halliday Typed Racket works by expanding a Racket program and typechecking the expansion, so match is just the ordinary Racket match. Racket’s match doesn’t do exhaustivity checking, so TR’s necessarily doesn’t, either. You could certainly write your own match that works differently, but that isn’t something TR has done, historically.


sam.halliday
2020-3-23 22:16:52

ah, cool, well that’s still very interesting.


lexi.lambda
2020-3-23 22:19:39

I think writing a standards-conforming Haskell 2010 implementation in Racket would mostly be a pointless exercise, aside from as a learning opportunity (though of course it would be good in that regard!). You’d end up with something strictly less useful than GHC Haskell! It would be an interesting project to try and add macros to Haskell syntax, of course, but that would be a serious undertaking.


sam.halliday
2020-3-23 22:22:52

Wtihout funding such a project would of course never be finished, but I think there is merit in having an alternative to ghc. Even if it is only to harden the language standards and provide a mechanism for bootstrapping ghc itself.


sam.halliday
2020-3-23 22:26:02

It concerns me that so many modern languages require previous versions of the compiler to build. Some languages are impossible to build without relying on a mysterious binary or unreleased proprietary compiler. e.g. very early versions of Scala require access to an Oracle-owned experimental language.


soegaard2
2020-3-23 22:28:05

You are thinking of the Ken Thompson talk/paper?


sam.halliday
2020-3-23 22:29:02

well, yes, and there was a proof of concept of that attack, but also portability.


sam.halliday
2020-3-23 22:31:06

and to avoid vendor lockin


sam.halliday
2020-3-23 22:32:09

taking haskell (ghc) as the example, we are all at the mercy of the development of ghc. It will be very difficult to go back to an older version of ghc to fork it, and eventually older versions of the compiler will be lost to us forever.


mflatt
2020-3-23 22:32:10

You might enjoy this diagram of how we start from C to compile Racket to compile a better Racket to compile a Racket simulation of Chez Scheme to compile Chez Scheme to compile Racket CS.


soegaard2
2020-3-23 22:33:42

No T’s :wink:


sam.halliday
2020-3-23 22:37:29

Thanks all, that’s been incredibly useful. I will now be able to dream about writing a Haskell compiler in Typed Racket, after I write an exhaustivity checker. Now all I need is some free time, which should be in about 2 decades when my kids are ready to leave the nest. :wave:


sam.halliday
2020-3-23 22:37:50

but I’ll sleep well tonight knowing that I have a project waiting for me


samth
2020-3-24 01:47:11

Note that there is one piece of pre-compiled code that you basically have to use, which is the fully expanded version of the expander. That’s checked in to the repository.


samth
2020-3-24 01:48:20

Technically it would be possible to go back through the racket7 repository to rebuild it repeatedly from the C version of the expander but no one has attempted that and I would recommend not trying.


samth
2020-3-24 01:48:52

However, the good news is that it’s not at all like machine code, it can be pretty readable.


mflatt
2020-3-24 01:51:17

And modifiable, since it’s just an S-expression with a lot of extra quotes around it. I have temporarily fixed bugs directly in “startup.inc” on a couple of occasions when it would have been a pain to roll back to bootstrap.


samth
2020-3-24 01:59:06

It would be “interesting” to try to make the expander work again in 6.9