spdegabrielle
2020-6-24 08:50:42

I just gave my job title and a brief overview of the sort of development I do professionally. I’m sure it’s not the only problem, and the responses will be also used to improve for the 2021 survey.


evyatar2013
2020-6-24 14:15:40

Does anyone have any recommended resources for integrating Racket programs into an existing non-racket code base? I can see at least two options: a) Expose the code as some service - interaction happens over APIs/DBs b) Expose the code as some library - interaction happens over FFI

Not entirely sure what the pros/cons of each approach is.


laurent.orseau
2020-6-24 14:19:56

I would create a Racket server that receives s-exprs (or commands), something like: https://github.com/Metaxal/rwind/blob/master/server.rkt


samth
2020-6-24 14:28:18

Accessing Racket using the FFI is likely to be challenging, so I also encourage option a


samth
2020-6-24 14:28:33

@popa.bogdanp wrote an iOS app using that approach


sorawee
2020-6-24 15:50:15

I don’t understand “please specify”. When I click those choices, there’s no text box appeared to let me specify anything. Am I supposed to use “Other” for that? @samth @spdegabrielle


sorawee
2020-6-24 15:52:02

Also pretty weird to have “Discord” in “How do you prefer to communicate with other members of Racket community?” but not “How do you keep informed about Racket?”


spdegabrielle
2020-6-24 15:58:32

Keep informed: Racket news, blog, announce list, Reddit Communicate: users/dev lists, IRC, slack, discord


spdegabrielle
2020-6-24 15:59:51

It’s not a great distinction because announcements happen on racket users or even slack.


spdegabrielle
2020-6-24 16:01:35

The please specify stuff isn’t great. This is our first go at a survey.


spdegabrielle
2020-6-24 16:01:42

Sorry


spdegabrielle
2020-6-24 16:01:51

Will do better next time


spdegabrielle
2020-6-24 16:02:10

@sorawee


spdegabrielle
2020-6-24 16:04:38

(Also discord is exactly the same chat app as slack but has a light text on a black background instead of dark text on a white background - you can change it in settings but I leave it that way so I don’t get confused)


cris2000.espinoza677
2020-6-24 17:43:39

@cris2000.espinoza677 has joined the channel


cris2000.espinoza677
2020-6-24 17:49:47

hello, i’m trying to find a way to eval my custom language through “make-module-evaluator”, i’ve encountered some problems as explained in this <https://www.reddit.com/r/Racket/comments/heutmd/evallinklet_cannot_use_linklet_loaded_with/|reddit post.> can someone help me?


soegaard2
2020-6-24 17:51:56

@cris2000.espinoza677 (define eval2 (make-module-evaluator "#lang reader \"reader.rkt\" racket/gui"))


soegaard2
2020-6-24 17:52:01

Perhaps?


soegaard2
2020-6-24 17:53:14

The #lang reader is used to specify the reader, so you still need the language name at the end: #lang reader &lt;reader&gt; &lt;module-path&gt;


sorawee
2020-6-24 17:54:13

Wait, really?


sorawee
2020-6-24 17:54:30

sorawee
2020-6-24 17:54:46

Here’s an example:

#lang reader "literal.rkt" Technology! System! Perfect!


soegaard2
2020-6-24 17:55:17

Oh! I misunderstood the docs.


cris2000.espinoza677
2020-6-24 18:02:25

well the thing is i could install the language as an alternative but it is not what i want. it also wouldn’t suit my needs


sorawee
2020-6-24 18:05:36

So, it’s not a problem with #lang reader "reader.rkt" per se


sorawee
2020-6-24 18:06:30

I just tried

#lang racket (require racket/sandbox) (sandbox-path-permissions (list* (list 'execute (current-directory)) (sandbox-path-permissions))) (define eval2 (make-module-evaluator "#lang reader \"literal.rkt\" abcdef")) (eval2 'data) where literal.rkt is the file from the Racket Guide I linked above. It works fine.


sorawee
2020-6-24 18:07:16

So the problem seems to be due to something inside your reader.rkt.


soegaard2
2020-6-24 18:10:02

The docs on code inspectors are here. I can’t remember seeing the "<https://www.reddit.com/r/Racket/comments/heutmd/evallinklet_cannot_use_linklet_loaded_with/|annot use linklet loaded with non-original code inspector"> error before, so I don’t have an idea of what you need to look for.



sorawee
2020-6-24 18:11:05

I wonder if https://docs.racket-lang.org/read-lang-file/index.html is more appropriate than racket/sandbox


sorawee
2020-6-24 18:11:23

The sandbox thing looks like a hassle to me.


cris2000.espinoza677
2020-6-24 18:16:39

ty for the insight but idk what it could be causing it, making a full file with #lang reader “reader.rkt” works :disappointed:


soegaard2
2020-6-24 18:17:38

Oh… so it has something to do with make-module-evaluator specifically?


cris2000.espinoza677
2020-6-24 18:17:55

i believe so


soegaard2
2020-6-24 18:18:17

Hmm. Does it work on Racket BC ?


cris2000.espinoza677
2020-6-24 18:19:08

racket BC? i havent use racket for long so idk what that is


cris2000.espinoza677
2020-6-24 18:19:39

i tried this (define eval2 (make-module-evaluator "#lang reader \"reader.rkt\" misc:hello$ food:\"delicious and nutricious\""))


soegaard2
2020-6-24 18:20:00

Racket BC is using the traditional Racket VM. Racket CS is the new one using “Chez Scheme” as the backend.


cris2000.espinoza677
2020-6-24 18:20:03

got this link: access disallowed by code inspector to unexported variable variable: token15.1 from module: “C:\Users\XXX\AppData\Roaming\Racket\7.6\pkgs\brag-lib\brag\support.rkt”


sorawee
2020-6-24 18:20:43

@cris2000.espinoza677 can you try this?

#lang racket (require lang-file/read-lang-file) (define ns (make-base-namespace)) (define mod (read-lang-module (open-input-string "#lang reader \"reader.rkt\""))) (define name (second (syntax-&gt;list mod))) (eval mod ns) (eval `(require ',name) ns)


cris2000.espinoza677
2020-6-24 18:20:55

im using drracket on default settings so i dont know


sorawee
2020-6-24 18:21:18

You might need to install the lang-file package first.


soegaard2
2020-6-24 18:22:25

I believe DrRacket writes BC or CS in the version message in the interaction window (repl).


cris2000.espinoza677
2020-6-24 18:23:22

ok going to check after it installs the packages


cris2000.espinoza677
2020-6-24 18:24:32

im using br/quicklang and the methods use in beautiful-racket so that might be causing something maybe


cris2000.espinoza677
2020-6-24 18:26:53

@sorawee what is suppose to happen?


sorawee
2020-6-24 18:27:20

It doesn’t error…


cris2000.espinoza677
2020-6-24 18:27:30

no


cris2000.espinoza677
2020-6-24 18:27:33

it doesnt


sorawee
2020-6-24 18:27:38

OK, that’s a good start


sorawee
2020-6-24 18:27:57

Does your #lang reader "reader.rkt" provide anything?


sorawee
2020-6-24 18:28:23

You can try (eval '&lt;provided-id&gt; ns)


cris2000.espinoza677
2020-6-24 18:28:31

no… ill change that now


sorawee
2020-6-24 18:28:36

and see if you can retrieve the &lt;provided-id&gt;


sorawee
2020-6-24 18:29:24

So for instance, in #lang reader "literal.rkt" in the Racket Guide above


sorawee
2020-6-24 18:29:31

it provides an identifier data, so (eval 'data ns) will retrieve the data identifier


cris2000.espinoza677
2020-6-24 18:29:31

ok it works


sorawee
2020-6-24 18:29:40

Cool!


cris2000.espinoza677
2020-6-24 18:29:58

@sorawee Thank you very much!


cris2000.espinoza677
2020-6-24 18:30:38

althought i’ll still have to think up different logic to do what i want it’s a good start


cris2000.espinoza677
2020-6-24 18:30:46

thank you everyone


cris2000.espinoza677
2020-6-24 18:34:25

@soegaard2 it really doesn’t show what vm racket is using apart from [3m]


sorawee
2020-6-24 18:35:17

3m = BC


sorawee
2020-6-24 18:38:13

@alexknauth is it a good idea to provide an evaluator function like this?

#lang racket (require lang-file/read-lang-file) (define ev (eval-lang-module "#lang racket (provide data) (define data 2) (println 1)")) ;; 1 is printed (ev 'data) ;; 2 is returned