
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.

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.

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

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

@popa.bogdanp wrote an iOS app using that approach

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

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?”

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

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

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

Sorry

Will do better next time

@sorawee

(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 has joined the channel

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?

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

Perhaps?

The #lang reader
is used to specify the reader, so you still need the language name at the end: #lang reader <reader> <module-path>

Wait, really?

https://docs.racket-lang.org/guide/hash-lang_reader.html doesn’t seem to indicate that

Here’s an example:
#lang reader "literal.rkt"
Technology!
System!
Perfect!

Oh! I misunderstood the docs.

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

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

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.

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

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.


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

The sandbox thing looks like a hassle to me.

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

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

i believe so

Hmm. Does it work on Racket BC ?

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

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

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

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”

@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->list mod)))
(eval mod ns)
(eval `(require ',name) ns)

im using drracket on default settings so i dont know

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

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

ok going to check after it installs the packages

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

@sorawee what is suppose to happen?

It doesn’t error…

no

it doesnt

OK, that’s a good start

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

You can try (eval '<provided-id> ns)

no… ill change that now

and see if you can retrieve the <provided-id>

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

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

ok it works

Cool!

@sorawee Thank you very much!

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

thank you everyone

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

3m = BC

@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