ted
2019-12-19 09:10:17

@ted has joined the channel


sorawee
2019-12-19 13:59:33

I want to make define* which is just like define except that it has some static information that I can later extract. I think this is what I want:

(define-syntax-parser define* [(_ x:id e:expr) #:with tmp (generate-temporary 'tmp) #`(begin (define tmp e) (define-syntax x #,(make-define*-info #'tmp)))]) where define*-info is a struct that holds static information and has prop:set!-transformer . But this doesn’t really work. It looks like the macroexpander says tmp is unbound. What’s a way to fix this?


sorawee
2019-12-19 14:16:28

Well, it’s also possible to just define total and staticmethod /sta1 at the top level directly, which means we won’t need that set! . My disappointment is that static method as a function clutters the namespace and it is not “packaged” along with the class value.


samth
2019-12-19 14:30:27

@sorawee that’s exactly what you should do so I’m not sure what the problem is


samth
2019-12-19 14:33:35

the problem is you need to remove the #,


samth
2019-12-19 14:35:07

in general Racket doesn’t use values for namespacing other values


sorawee
2019-12-19 14:40:57

Ahhhh! I forgot that define-syntax shifts phase already, and I don’t need to unquote to access make-define*-info at phase 1. Thanks! :slightly_smiling_face:


alexknauth
2019-12-19 15:30:47

Oh! I think I finally figured out what was going wrong. It was restoring the wrong vm snapshot! So I think all I have to do is delete all the snapshots I currently have (all named init), and then make a new snapshot to be called init


alexknauth
2019-12-19 15:45:03

Nope, still running into problems. Last night I could ssh into it manually, now I can’t anymore


deactivateduser60718
2019-12-19 15:50:58

From what I’m seeing it looks like there’s a precedent for one implementation collection per multi-collection package. Could I make a multi-collection package with multiple library collections that users can opt-in to using? What would the raco pkg install command look like?


deactivateduser60718
2019-12-19 15:52:20

Use case being: Small implementation for a core API, with other collections in the package offering useful recipes with added dependencies.


alexknauth
2019-12-19 15:53:37

Just switched rooms from my bedroom to .@gknauth’s wfh office (that’s what I did last night to “fix” ssh-ing manually) and now I can ssh manually again. I do not understand why

anyway restarting run.rkt again now


samth
2019-12-19 15:54:20

I don’t think that’s accurate. For example, the typed-racket-lib package has multiple collections


deactivateduser60718
2019-12-19 15:59:00

Right, but the name ending in -lib is another package, not a collection, right?

I’m thinking of a directory structure like this, where users get lib1 by default but can specify that they also want lib2 by the time they run raco pkg install package/ collection-lib1 collection-lib2 collection-docs collection-tests


deactivateduser60718
2019-12-19 15:59:28

If I’m understanding your message right, the solution is to create another package.


samth
2019-12-19 15:59:34

I’m confused about what you are asking.


samth
2019-12-19 15:59:49

there are two very separate considerations.


samth
2019-12-19 16:00:07
  1. What collections should things be in.
  2. What packages should things be in.

deactivateduser60718
2019-12-19 16:00:42

Let me see if I can phrase it better.


deactivateduser60718
2019-12-19 16:00:55

Say I only want to publish one package.


deactivateduser60718
2019-12-19 16:01:04

One collection in that package has a core API


deactivateduser60718
2019-12-19 16:01:30

Another has a bunch of dependencies and recipes, but also contains implementation code


gknauth
2019-12-19 16:01:48

@alexknauth Thanks for the reminder to try your build setup while at work on my personal MBP. Anyway, when you’re in the other room, not my wfh office, I wonder which wifi you’re on. One ends with a 2 (it’s 2.4GHz), the one that doesn’t is 5GHz. I don’t think that’s it, because even though Ubuntu typically only does 2.4GHz, its connectivity is through your MBP, which handles both. Anyway, I’ll try the setup at work and on my MBP and see what happens.


deactivateduser60718
2019-12-19 16:02:02

How would a user install the package to get the core API by default, ~but~ versus opt-in to the extras?


rokitna
2019-12-19 16:09:21

looks like your example is a bunch of packages with names containing “collection,” which is kind of confusing


samth
2019-12-19 16:09:53

The way to do that is to publish two packages


samth
2019-12-19 16:10:05

Such as “foo” and “foo-extra”


samth
2019-12-19 16:10:18

and they might both use the foo collection


rokitna
2019-12-19 16:10:43

in this kind of setup, there’s often a foo package that implies the foo-lib and foo-doc packages, so the user can install foo to get the other two packages installed automatically


rokitna
2019-12-19 16:12:06

and if the user wants they can also install foo-test explicitly, but that isn’t something many users would need unless they’re developing the library


rokitna
2019-12-19 16:14:13

even the foo-test package could contain modules that are in the same collections as the other packages. The collection doesn’t need to be named anything like “foo” except that it might become a little more confusing for people who want to look up what package they need to install to get their require to work


deactivateduser60718
2019-12-19 16:31:27

> looks like your example is a bunch of packages with names containing “collection,” which is kind of confusing I’m going off of this: https://docs.racket-lang.org/pkg/Package_Concepts.html?q=multi-collection#%28tech._multi._collection._package%29

> The way to do that is to publish two packages I figured. Was hoping that wasn’t the case.


samth
2019-12-19 16:32:28

Why is that a problem?


deactivateduser60718
2019-12-19 16:33:37

I wanted to avoid polluting the package index with a bunch of similar names.


deactivateduser60718
2019-12-19 16:33:48

Well, still do


deactivateduser60718
2019-12-19 16:36:24

There have been a couple of times where I wanted a package to be a “one-stop shop” for all code related to a topic to keep things organized from a high-level. I’m just trying to find ways to do that.


alexknauth
2019-12-19 17:12:53

I finally got through the ssh stage, but then it failed with what appears to be a, paren error? VM "racket-pkg-build" has been successfully started. /usr/bin/ssh -R 18333:localhost:18333 racket@192.168.56.103 '/usr/bin/env' 'PLTUSERHOME=/home/racket/build-pkgs/user' 'PLT_PKG_BUILD_SERVICE=1' 'CI=true' 'PLTSTDERR=debug@pkg error' 'PLT_INFO_ALLOW_VARS=;PLT_PKG_BUILD_SERVICE' '/bin/sh' '-c' 'echo hello' hello >> Fixing time at racket-pkg-build /usr/bin/ssh -R 18333:localhost:18333 racket@192.168.56.103 '/usr/bin/env' 'PLTUSERHOME=/home/racket/build-pkgs/user' 'PLT_PKG_BUILD_SERVICE=1' 'CI=true' 'PLTSTDERR=debug@pkg error' 'PLT_INFO_ALLOW_VARS=;PLT_PKG_BUILD_SERVICE' '/bin/sh' '-c' 'sudo date --set="Thu, 19 Dec 2019 12:09:07 -0500"' Thu Dec 19 12:09:07 EST 2019 >> Preparing directory /home/racket/build-pkgs /usr/bin/ssh -R 18333:localhost:18333 racket@192.168.56.103 '/usr/bin/env' 'PLTUSERHOME=/home/racket/build-pkgs/user' 'PLT_PKG_BUILD_SERVICE=1' 'CI=true' 'PLTSTDERR=debug@pkg error' 'PLT_INFO_ALLOW_VARS=;PLT_PKG_BUILD_SERVICE' '/bin/sh' '-c' 'rm -rf "/home/racket/build-pkgs"/*' /usr/bin/ssh -R 18333:localhost:18333 racket@192.168.56.103 '/usr/bin/env' 'PLTUSERHOME=/home/racket/build-pkgs/user' 'PLT_PKG_BUILD_SERVICE=1' 'CI=true' 'PLTSTDERR=debug@pkg error' 'PLT_INFO_ALLOW_VARS=;PLT_PKG_BUILD_SERVICE' '/bin/sh' '-c' 'mkdir -p "/home/racket/build-pkgs"' /usr/bin/ssh -R 18333:localhost:18333 racket@192.168.56.103 '/usr/bin/env' 'PLTUSERHOME=/home/racket/build-pkgs/user' 'PLT_PKG_BUILD_SERVICE=1' 'CI=true' 'PLTSTDERR=debug@pkg error' 'PLT_INFO_ALLOW_VARS=;PLT_PKG_BUILD_SERVICE' '/bin/sh' '-c' 'mkdir -p "/home/racket/build-pkgs/user"' /usr/bin/ssh -R 18333:localhost:18333 racket@192.168.56.103 '/usr/bin/env' 'PLTUSERHOME=/home/racket/build-pkgs/user' 'PLT_PKG_BUILD_SERVICE=1' 'CI=true' 'PLTSTDERR=debug@pkg error' 'PLT_INFO_ALLOW_VARS=;PLT_PKG_BUILD_SERVICE' '/bin/sh' '-c' 'mkdir -p "/home/racket/build-pkgs/built"' /usr/bin/scp /Users/Alex/racket-pkg-build/installer/racket-7.5.0.13-x86_64-macosx.dmg racket@192.168.56.103:/home/racket/build-pkgs racket-7.5.0.13-x86_64-macosx.dmg 100% 117MB 61.4MB/s 00:01 /usr/bin/ssh -R 18333:localhost:18333 racket@192.168.56.103 '/usr/bin/env' 'PLTUSERHOME=/home/racket/build-pkgs/user' 'PLT_PKG_BUILD_SERVICE=1' 'CI=true' 'PLTSTDERR=debug@pkg error' 'PLT_INFO_ALLOW_VARS=;PLT_PKG_BUILD_SERVICE' '/bin/sh' '-c' 'cd "/home/racket/build-pkgs" && sh "racket-7.5.0.13-x86_64-macosx.dmg" --in-place --dest ./racket' racket-7.5.0.13-x86_64-macosx.dmg: 1: racket-7.5.0.13-x86_64-macosx.dmg: Syntax error: "(" unexpected ssh: failed context...: /Users/Alex/Library/Racket/snapshot-7.5.0.13--2019-12-16/pkgs/pkg-build/main.rkt:452:5 /Users/Alex/Library/Racket/snapshot-7.5.0.13--2019-12-16/pkgs/pkg-build/main.rkt:445:2: install /Users/Alex/Library/Racket/snapshot-7.5.0.13--2019-12-16/pkgs/pkg-build/main.rkt:515:2: check-and-install /Users/Alex/Library/Racket/snapshot-7.5.0.13--2019-12-16/pkgs/pkg-build/main.rkt:123:0: build-pkgs "/Users/Alex/racket-pkg-build/run.rkt": [running body] temp35_0 for-loop run-module-instance! perform-require! Stopping VirtualBox machine "racket-pkg-build"


winny
2019-12-19 17:28:06

Are there any guides/examples to making a plugin system in Racket? I know Dr.Racket has a signature/unit based system, though my application’s plugins will define their own behaviors - sort of flipping the notion of a plugin system on its head, so this may not be sufficient.


capfredf
2019-12-19 17:33:34

@alexknauth racket-7.5.0.13-x86_64-macosx.dmg doesn’t look right to me


alexknauth
2019-12-19 17:34:09

Oh good point. Why is it using the mac installer when ssh-ing into the linux vm?


capfredf
2019-12-19 17:35:10

can you post the content of your table.rtkd


laurent.orseau
2019-12-19 17:35:12

Quickscript has/is a simpler plugin system (for DrRacket) based on the more complex plugin system of DrRacket. Most relevant code portion: https://github.com/Metaxal/quickscript/blob/master/tool.rkt#L142


winny
2019-12-19 17:35:21

Some background - I’m set on making a framework for implementing irc bots/interactive clients. The more consideration I did, the clearer it seemed to do well to make each component (user/channel tracking, chat commands, even the irc client) pluggable. This way it becomes easy to enable/disable features at runtime and replace certain components [especially commands]. I envision the entire system will be publish/subscribe, actor, or message bus based.


alexknauth
2019-12-19 17:36:02

It’s just #hash(("localhost" . "racket-7.5.0.13-x86_64-macosx.dmg")).


deactivateduser60718
2019-12-19 17:36:10

The web-server collection uses signatures and units to allow customization of either servers or the configuration of default implementations. I wouldn’t call it a plugin system, but it does show how each component can be overridden.



capfredf
2019-12-19 17:37:24

I see. I probably know what is the problem ..


winny
2019-12-19 17:37:45

Thanks, It’s good to see these patterns used in several different collections


capfredf
2019-12-19 17:38:02

Does @ben run the whole process of pkg-build on a linux machine?


deactivateduser60718
2019-12-19 17:38:14

It’s super easy to make up mini-protocols as you go.


deactivateduser60718
2019-12-19 17:38:35

That’s a mixed blessing.


capfredf
2019-12-19 17:40:34

My wild guess is you have to build a racket installer on a linux machine (via make installers) I forgot to mention that in my comment…


winny
2019-12-19 17:41:25

I’m sort of wary of that, with an side-goal of making it very clear upon loading if a plugin using other plugins correctly; originally I was going to implement it in TR, only allowing racket for the actual plugin implementations, but it appears signatures/units and dynamic-rerequire don’t have the best TR support. So I think I may have to accept some “loosey goosey” interfaces


capfredf
2019-12-19 17:41:36

Now I remember why I have two virtualbox vms …


capfredf
2019-12-19 17:42:26

winny
2019-12-19 17:44:18

an easier goal might be to add a good amount of fault tolerance, executing each plugin method/implementation with handling exceptions and otherwise handling a bad plugin’s instantiation gracefully


capfredf
2019-12-19 17:50:34

@alexknauth I have changed my comment accordingly


capfredf
2019-12-19 17:53:53

@alexknauth if you run start the pkg server on the machine where you create the installer, make sure that server is accessible from the pkg build vm


alexknauth
2019-12-19 17:55:37

I could also run make installers and make site-from-installers on the vm, then copy the folder over to the host to run the server, right?


capfredf
2019-12-19 17:58:15

Yes.


deactivateduser60718
2019-12-19 17:59:44

If typed racket is asked to load code from a potentially untyped source during runtime you’re already past the point where you can ask for type safety anyway (If I’m understanding your message). I’d probably use is-a? to check if an object implements an interface, but that’s only because I don’t know of a better alternative.


laurent.orseau
2019-12-19 18:03:09

Just in case, another kind of safety can be obtained through racket/sandbox for plugin systems


ben
2019-12-19 18:18:55

wow, annoying.

I’ve been running everything on Linux.

The other day I finished a full build, but the process got stopped & restarted mid-way many times due to ssh errors. I’m trying again now with a 3x longer #:timeout and with 10 #:tries in the call to make-sure-remote-is-ready and so far (overnight) there are no errors


spdegabrielle
2019-12-19 18:52:10

This is a simple example of a DrRacket plugin/tool created by Robby

https://github.com/spdegabrielle/robby-tool-demo\|https://github.com/spdegabrielle/robby-tool-demo


capfredf
2019-12-19 18:55:22

@alexknauth BTW, in theory, you could run macOS on a virtualbox vm to build pkgs, but I haven’t done that before and I have only used VMWare to virtualize macOS.


slack1005
2019-12-19 19:55:00

@slack1005 has joined the channel


gknauth
2019-12-19 20:03:18

@alexknauth Where are the instructions you wanted me to follow?


winny
2019-12-19 21:28:08

Yep, if plugins were in vanilla racket, and the plugin-based application was in TR, i’d lose some type safetly, but I’d still have an application in TR that should eliminate most classes of bugs I run into ;)


alexknauth
2019-12-20 01:57:30

It’s finally running!


cosmez
2019-12-20 02:38:00

is there any built in hash function?


cosmez
2019-12-20 02:38:13

string hash


samth
2019-12-20 02:41:20

You might want equal-hash-code


cosmez
2019-12-20 02:45:32

yep, that one works. thanks!


notjack
2019-12-20 06:09:55

I’ve wanted that too