soegaard2
2019-6-3 10:07:23

popa.bogdanp
2019-6-3 16:12:25

I think I’ve found a bug in the package server. My new package1 is marked as having conflicts but the link takes me to https://pkg-build.racket-lang.org/(indirect%20conflicts.txt) rather than https://pkg-build.racket-lang.org/conflicts.txt . My package doesn’t show up in the latter so I’m not sure what’s up. Has anyone run into this before?


popa.bogdanp
2019-6-3 16:13:26

Ah. https://pkg-build.racket-lang.org/ says there are conflicts in a dependency which now makes sense (because it depends on postmark-client, which does have conflicts and appears in the conflicts.txt file). Nevermind. :smile:


popa.bogdanp
2019-6-3 17:16:17

Is there a way to declare that a particular folder within a package should be ignored upon install?

Currently, I have https://github.com/Bogdanp/koyo/tree/master/koyo-lib, which refers to https://github.com/Bogdanp/koyo/tree/master/blueprints at runtime. This works fine for development if I install koyo-lib as a linked package. It doesn’t work when I deploy the package because the location of blueprints is outside of the package’s installation path so I get this error after I install the package:

directory-list: could not open directory
  path: /root/.racket/7.3/pkgs/koyo-lib/koyo/../../blueprints

If I move blueprints inside koyo-lib, then that causes problems as well because blueprints contains racket code (and koyo-lib is declared as a multi-collection package (though I could change it to a single collection package, but I’m not sure that would help)).


popa.bogdanp
2019-6-3 17:16:51

So what I would like to do is move blueprints into koyo-lib but somehow tell raco pkg that it should ignore the blueprints folder when koyo-lib is installed.


popa.bogdanp
2019-6-3 17:17:48

I have read about the source-omit-files configuration value but I don’t think that’ll do what I want. It sounds like if I add blueprints to source-omit-files, it’ll remove the folder before the package is installed.


popa.bogdanp
2019-6-3 17:17:51

Any ideas?


ryanc
2019-6-3 17:21:35

@popa.bogdanp if you want raco setup to avoid trying to compile that subdirectory, I think you want compile-omit-paths. (I didn’t find source-omit-files)


popa.bogdanp
2019-6-3 17:22:14

Ah. That sounds promising! Thank you!


popa.bogdanp
2019-6-3 17:23:05

popa.bogdanp
2019-6-3 17:23:58

Also, are all of the #info configuration options listed in an index anywhere?


popa.bogdanp
2019-6-3 17:34:33

@ryanc that did the trick. Thanks again!


philip.mcgrath
2019-6-3 21:45:29

@carl.morris.world Are you still having trouble? If so, I think the concept of phases might help: basically, a phase either compile-time or run-time. In Racket, though, the compile-time of some code that uses a macro is the run-time of the macro’s implementation. Since macros can (and usually are) written using other macros, we have a more general notion of phases to be able to talk about the compile-time of the compile-time, which is ultimately the run-time of something.


philip.mcgrath
2019-6-3 21:53:57

In your example, parse returns a run-time value representing a piece of syntax. On the other hand, record is bound to a macro for use in the implementation of your example. Nothing connects the two pieces.


philip.mcgrath
2019-6-3 21:56:45

The normal way to use brag is in the implementation of a custom reader for a new #lang language. The reader implementation would produce the syntax for a Racket module (i.e. (module foo my-new lang "a"). The language implementation would then provide the record implementation for use by programs written in your new language.


carl.morris.world
2019-6-3 22:07:37

Thanks for following up. I settled on a solution based on creating a #lang language with a #%module-begin macro that expands to something like (provide result) (define result ,read-syntax) then in the user module there’s a function that wraps the CSV in make-module-evaluator to get the value of the result variable exported by the module. I think this is similar to what you described.

Phases is definitely the missing concept for me. I just barely understand that macros expand during a different phase compared to when (most) functions evaluate. I think part of the confusion is that I can write macros on the REPL and everything seems to work and then I seemingly get different results compared to a module.

I assume this differences is due to how phases are handled.


carl.morris.world
2019-6-3 22:11:10

Alternatively, I’m considering changing to simply use syntax->datum and treat the result kinda like an xexpr that I iterate through, delaying evaluation using quoting instead of macros.


philip.mcgrath
2019-6-3 22:19:23

Your current plan is very reasonable. #lang info does something very similar, as does #lang scribble/manual (for much more complicated values).


philip.mcgrath
2019-6-3 22:21:32

Doing syntax->datum and manipulating the raw data could also work. It depends on what your overall goals are. Do you need to accept untrusted input? Do quotable Racket datatypes work well for what you need?


philip.mcgrath
2019-6-3 22:23:38

If you go for a syntax->datum-like approach, parser-tools/yacc lets you write actions as normal Racket expressions, so you wouldn’t have to build up an s-expression AST as with brag.


carl.morris.world
2019-6-4 00:14:34

I guess you’re right that syntax->datum might leave you vulnerable to racket code embedded in the CSV data.

I’ll have to take a look at parse-tools/yacc. My initial goal was to simply try expressing a CSV as a parameterized #lang brag parser. However as I worked with it, I had the idea to make an executable CSV.

The idea is to expand the CSV into a racket form (not sure the exact format) which the user provides definitions for (perhaps through parameterizing some procedures/callbacks).


carl.morris.world
2019-6-4 00:17:28

Some of this functionality already exists in the csv-reading module so I may look there next to see if I can implement what I want as a layer on top of that.