com schrieb am Dienstag, 6. Juli 2021 um 09:53:41 UTC+2:
>
>> Good morning everyone,
>>
>> Sorry, this is a bit of a noob question, but this is my first Racket
>> program :-)
>> I build a CRUD in Racket web-server, everything seems to work well but my
>> S
et/db/issues/10
Simon
rohanpo...@gmail.com schrieb am Dienstag, 6. Juli 2021 um 09:53:41 UTC+2:
> Good morning everyone,
>
> Sorry, this is a bit of a noob question, but this is my first Racket
> program :-)
> I build a CRUD in Racket web-server, everything seems to work well but
Good morning everyone,
Sorry, this is a bit of a noob question, but this is my first Racket
program :-)
I build a CRUD in Racket web-server, everything seems to work well but my
Sqlite database does not update the data until I restart the server. I
tried a few things, but all in vain.
Any
[ (binding:file? b) (values
> >> >(bytes->string/utf-8 (binding-id b)
> #\space)
> >> >(binding:file-content b)) ])))
> >> >
> >> > It appears that the entire file contents ar
orm-value b)
>> > #\space)) ]
>> > [ (binding:file? b) (values
>> >(bytes->string/utf-8 (binding-id b) #\space)
>> > (binding:file-content b)) ])))
>> >
>> > I
(binding:file-content b)) ])))
> >
> > It appears that the entire file contents are in the binding by the time
> the
> > request is available to me. This is fine for "small enough" files, but
> for
> > larger files, it would be great to be able to st
ng-id b)
> #\space)
> >(binding:file-content b)) ])))
> >
> > It appears that the entire file contents are in the binding by the time
> the
> > request is available to me. This is fine for "small enough" files, but
> for
e able to stream the file contents. The
> solution may be to use something like nginx's upload module:
>
> https://www.nginx.com/resources/wiki/modules/upload/
>
> But before I go down that route, I thought I'd ask if the Racket web server
> provides a more direct way
's upload module:
https://www.nginx.com/resources/wiki/modules/upload/
But before I go down that route, I thought I'd ask if the Racket web server
provides a more direct way to accomplish this.
Thanks,
Brian
--
You received this message because you are subscribed to the Google Groups
"R
> On Sep 26, 2017, at 5:13 PM, Alexis King wrote:
>
> In fact, to elaborate a little bit more: what you probably want to do
> is only support HTTPS, but you will not want to only listen on port 443 ...
> What you will want to do instead is automatically redirect any users who
> use HTTP to the e
equest to your Racket server over ordinary
>>> HTTP.
>>> It will>>> subsequently encrypt the response it receives, then send it back
>>> to the>>> client. This means your Racket server doesn’t need to worry
>>> about SSL>>
>> OK
> On Sep 26, 2017, at 5:04 PM, Matthew Butterick wrote:
>
> What about the new HTTP port that the Racket web server has opened?
> Should that be secured somehow (e.g., firewall)?
Yes. For any server exposed to the internet, you want to make sure to
only whitelist the appropriate por
t; It will>> subsequently encrypt the response it receives, then send it
>> back to the>> client. This means your Racket server doesn’t need to worry
>> about SSL>
> OK thanks. That works. It just seems like cheating — laundering HTTP
> into HTTPS.>
> What
bsequently encrypt the response it receives, then send it back to the
> client. This means your Racket server doesn’t need to worry about SSL
OK thanks. That works. It just seems like cheating — laundering HTTP into HTTPS.
What about the new HTTP port that the Racket web server has opened? Sh
You almost certainly want to do SSL termination at the Apache level if
you are running a Racket server behind Apache. This means that Apache
will serve as a reverse proxy to your Racket web server, and all
communications between Apache and the Racket process will be ordinary
HTTP. When an HTTPS
The docs for "How do I use Apache with the Racket Web Server?" demonstrate how
to set up proxying between Apache and the Racket web server within an .htaccess
file. [1]
That technique works. But only with ordinary HTTP. AFAICT it does not work for
HTTPS.
What's the best way to
You want to use #:method in the dispatch-clause. From the docs, "If
method is left out, it assumed to apply to requests without methods
and GET methods." (i.e. not POST methods.)
http://docs.racket-lang.org/web-server/dispatch.html?q=dispatch-rules#%28form._%28%28lib._web-server%2Fdispatch..rkt%29
Hi everyone, recently i start learn write a web api service in racket,but in
dispatch-rules part i had a problem.
; handler.rkt
#lang racket
(require
web-server/http)
(define (user req)
(response/xexpr
#:mime-type #"application/json"
"{hello: User}"))
; routers.rkt
#lan
Ergh... Indeed, that did the trick. Thanks Daniel.
On Sat, Apr 1, 2017 at 5:34 PM, Daniel Brunner wrote:
> Hi Marc,
>
> I used this setup several times.
>
> Marc Kaufmann hat am 1. April 2017 um 23:01
> geschrieben:
> location / {
> try_files proxy_pass http:///127.0.0.1:8080;
> }
>
> I think y
Hi Marc,
I used this setup several times.
Marc Kaufmann hat am 1. April 2017 um 23:01
geschrieben:
location / {
try_files proxy_pass http:///127.0.0.1:8080;
}
I think you should omit the "try_files". I think it should read:
location / {
proxy_pass http:///127.0.0.1:8080;
}
Best wishes,
Da
Hi all,
this should be simple, but I couldn't get it working, so I am here. I am using
nginx on my server since I have multiple domains. I am trying to pass all the
requests to this particular instance to the Racket server, which according to
the docs works like this for Apache:
RewriteEngine
TL;DR: These are legacy things that you should probably ignore.
On Tue, Jul 5, 2016 at 6:31 PM, Daniel Bastos wrote:
>
> I'm investigating the Racket Web Server. It seems to me the default
> server-root-path is
>
> Racket/share/pkgs/web-server-lib/web-server/def
I'm investigating the Racket Web Server. It seems to me the default
server-root-path is
Racket/share/pkgs/web-server-lib/web-server/default-web-root/htdocs
because I specified ``#:server-root-path "htdocs"'' and I saw the
program was missing conf/ files and it gave
On Mon, Feb 8, 2016 at 1:43 PM, George Neuner wrote:
> On Mon, 8 Feb 2016 11:16:03 -0500, Sam Tobin-Hochstadt
> wrote:
>
>>The vulnerability affects web servers that serve static files using
>>the `#:extra-static-files` option, including the default value of this
>>option.
>
> Um ... where is tha
On Mon, 8 Feb 2016 11:16:03 -0500, Sam Tobin-Hochstadt
wrote:
>The vulnerability affects web servers that serve static files using
>the `#:extra-static-files` option, including the default value of this
>option.
Um ... where is that keyword used? Or documented?
I'm using 6.1.1 (yes, I know
We recently discovered a serious security vulnerability in the Racket
web server, which can lead to unintended disclosure of files on the
machine running the web server. This vulnerability is fixed in Racket
version 6.4, just released, and we encourage people to upgrade to that
version.
The
alogue in the Racket web server with the
idea of that sort of “extensible” routing?
Thanks for the help,
Alexis
> On Mar 21, 2015, at 19:26, Jay McCarthy wrote:
>
> The Web server models applications as "servlet : request -> response"
> and there's no way to go f
ing on. This is implemented by making the handshake a standard
> HTTP 1.1 GET request with an “Upgrade: websocket” header.
>
> I’m interested in doing this using the Racket web server, but I’m not sure
> how to intercept websocket connections. I’m completely willing to implement
>
interested in doing this using the Racket web server, but I’m not sure how
to intercept websocket connections. I’m completely willing to implement all the
websocket connection logic myself, I just need to know how to detect headers
sent with that Upgrade header before the web server has a chance to
Just checking my mail now after the holiday... I've thought that I've
seen this before, but the problem has been something else in each
case. In one case I actually had something like an infinite loop in my
program that starved the CPU of the accept() thread and so there were
TCP-level timeouts on
On 12/29/2014 08:25 PM, George Neuner wrote:
>> Are you using Racket's SSL support, or is it http-only?
> It's HTTP only. My application hides behind Apache on the same host so
> it doesn't need SSL.
That's good to know -- so *if* it's the same fault we're both seeing,
then it's not limited to ju
On 12/29/2014 6:52 PM, Tony Garnock-Jones wrote:
On 12/29/2014 06:30 PM, Neil Van Dyke wrote:
> Maybe someone who has the problem could use JMeter (or "ab", or similar)
> to pound the server and reproduce the failure quickly, under debugging
> conditions?
I've tried ab on it:
- many-requests
Hi Tony,
On 12/29/2014 6:21 PM, Tony Garnock-Jones wrote:
On 12/29/2014 04:09 PM, George Neuner wrote:
> Over the weekend my webserver application suddenly stopped responding to
> TCP connections. It was following a large spate of broken connections
> caused by debugging an issue on the browser
On 12/29/2014 06:30 PM, Neil Van Dyke wrote:
> Maybe someone who has the problem could use JMeter (or "ab", or similar)
> to pound the server and reproduce the failure quickly, under debugging
> conditions?
I've tried ab on it:
- many-requests doesn't seem to provoke the fault;
- rapid-requests
Hopefully others who've had this or related problems speak up too!
Maybe someone who has the problem could use JMeter (or "ab", or similar)
to pound the server and reproduce the failure quickly, under debugging
conditions?
Neil V.
Racket Users list:
http://lists.rac
On 12/29/2014 04:09 PM, George Neuner wrote:
> Over the weekend my webserver application suddenly stopped responding to
> TCP connections. It was following a large spate of broken connections
> caused by debugging an issue on the browser side.
Great! I, too, have spotted this problem in at least
Hi all,
Using 6.0.1.
Over the weekend my webserver application suddenly stopped responding to
TCP connections. It was following a large spate of broken connections
caused by debugging an issue on the browser side. In mucking with the
browser JS code I was repeatedly interrupting handling a
On 12/4/2014 11:54 PM, Jon Zeppieri wrote:
The part about HTML forms is true. From the HTML 5 spec:
[https://html.spec.whatwg.org/multipage/forms.html#attr-fs-method].
There are also various discussions about this, like
[http://programmers.stackexchange.com/a/211790].
Thanks! That was interest
The part about HTML forms is true. From the HTML 5 spec:
[https://html.spec.whatwg.org/multipage/forms.html#attr-fs-method].
There are also various discussions about this, like
[http://programmers.stackexchange.com/a/211790].
My XHR tests against Jay's code (using a Safari's JS console) work fine:
Hi Jon,
On 12/4/2014 10:37 PM, Jon Zeppieri wrote:
To my knowledge none of the major browsers support HTML forms using anything
but GET and POST. This is a user agent issue; not a server issue. (Some
frameworks use JS to intercept form submissions and perform them via XHR, which
can use other
To my knowledge none of the major browsers support HTML forms using anything
but GET and POST. This is a user agent issue; not a server issue. (Some
frameworks use JS to intercept form submissions and perform them via XHR, which
can use other methods.) I haven't had a chance to take a close look
On 12/4/2014 8:26 PM, Jay McCarthy wrote:
Were you not able to run my example? In the sample you sent, your
cases for delete and put are commented out.
Addendum: if I say: action="/resources/spam" as I should be able to,
the XHR appears to work, but still no data received by the server for
P
On 12/4/2014 8:26 PM, Jay McCarthy wrote:
Were you not able to run my example? In the sample you sent, your
cases for delete and put are commented out.
Those functions were commented out because they would not dispatch properly.
Something is weird. I had to grab a copy of curl ... I'd never u
Were you not able to run my example? In the sample you sent, your
cases for delete and put are commented out.
In the code you quote, the second to last case is [meth ...] and that
handles all methods not mentioned.
Jay
On Thu, Dec 4, 2014 at 8:23 PM, George Neuner wrote:
> Hi Jay,
>
> Additiona
It would have been interesting to see what you tried. The simplest
thing I could think of worked fine. Here's a little database app:
#lang racket/base
(require web-server/http
web-server/servlet-env
web-server/dispatch)
(define (writer s)
(λ (op)
(displayln s op)))
(defin
Hi all,
I'm using 6.0.1 trying to implement a CRUD interface, but the
dispatch-rules doesn't seem to recognize PUT or DELETE as valid methods
- they both are interpreted as GET.
Is dispatch-rules limited to HTML 1.0 (i.e. only GET, POST and HEAD)?
Has this been updated since 6.0.1? The cur
Hi Jay,
On 11/20/2014 9:39 AM, Jay McCarthy wrote:
A response is a value. The various response/* functions just return
these values. A servlet is a "request -> response" function, which
means that the response you send back is the value the servlet
returns.
I think that's where I got the idea
A response is a value. The various response/* functions just return
these values. A servlet is a "request -> response" function, which
means that the response you send back is the value the servlet
returns. Your use of an escape continuation to simulate C's "return"
statement is standard practice.
Hi all,
Using 6.0.1
I was under the (maybe mistaken) impression that calling response/...
terminated the servlet thread. It seems though that it doesn't. I was
hoping to use response as an early exit, so that my servlets look like:
e.g.,
(define (user/exists request)
(let* [
Hi George,
I suggest that all Racket web-server apps not use the dynamic features
of serve/servlet either, but instead write the servlet as the single
"request -> response" function that serve/servlet provides. This would
ensure that all the libraries are loaded the one time and
On 9/25/2014 6:26 PM, Jay McCarthy wrote:
web-server/servlet is NOT shared, nor is any net library or common
racket library like racket/list. They are all totally unique per
servlet.
This, by the way, is part of why I don't recommend using dynamic
servlets at all and suggest using serve/servlet.
On Thu, Sep 25, 2014 at 4:34 PM, George Neuner wrote:
> Hi Jay,
>
> On 9/25/2014 1:04 PM, Jay McCarthy wrote:
>
>> If a Racket library is deliberately put into the servlet-namespace, does
>> that streamline linking?
>
> Your assumption about the purpose of this is not correct. Anything in
> the se
Hi Jay,
On 9/25/2014 1:04 PM, Jay McCarthy wrote:
> If a Racket library is deliberately put into the servlet-namespace, does
> that streamline linking?
Your assumption about the purpose of this is not correct. Anything in
the servlet-namespace will be shared between all servlets, and thus
not l
On Thu, Sep 25, 2014 at 12:51 PM, George Neuner wrote:
> Hi Jay,
>
> On 9/23/2014 10:03 PM, Jay McCarthy wrote:
>
> The command-line tool is basically deprecated and only provided for
> backwards compatibility. There is a huge amount that it can't do at
> all and it hasn't been the primary way tha
Hi Jay,
On 9/23/2014 10:03 PM, Jay McCarthy wrote:
The command-line tool is basically deprecated and only provided for
backwards compatibility. There is a huge amount that it can't do at
all and it hasn't been the primary way that we recommend using the Web
server for a very long time.
I'm not
On Tue, Sep 23, 2014 at 9:19 PM, George Neuner wrote:
> Hi Jay,
>
> On 9/23/2014 6:04 PM, Jay McCarthy wrote:
>
> On Tue, Sep 23, 2014 at 4:42 PM, George Neuner wrote:
>>
>> 1) Is there any way to speed up initial [module] servlet loading?
>
> This is why I recommend that new users use serve/serv
Hi Jay,
On 9/23/2014 6:04 PM, Jay McCarthy wrote:
On Tue, Sep 23, 2014 at 4:42 PM, George Neuner wrote:
>
> 1) Is there any way to speed up initial [module] servlet loading?
This is why I recommend that new users use serve/servlet, which is
much faster because it does not use namespaces or liv
On Tue, Sep 23, 2014 at 4:42 PM, George Neuner wrote:
> Hi,
>
> I'm using 6.0.1 and I have a couple of questions regarding module
> servlets. I'm new to the server side of Racket so please be gentle.
>
>
> 1) Is there any way to speed up initial servlet loading? Even for a
> very simple servlet
Hi,
I'm using 6.0.1 and I have a couple of questions regarding module
servlets. I'm new to the server side of Racket so please be gentle.
1) Is there any way to speed up initial servlet loading? Even for a
very simple servlet (does nothing, canned response for testing)
several seconds elapse
Racket would definitely be 'load-balancing', but I'd be surprised if
that would affect performance because the REPL thread should just be
blocked on input. I'd be worried that the way the REPL was started ran
the server without the JIT.
Jay
On Thu, Aug 28, 2014 at 7:40 PM, Matthew Butterick wrot
To implement your suggestion, I tried starting the web server from the real
REPL by making `raco pollen start` invoke a system command along these lines:
racket -i -l pollen/server -e '(define t (thread (lambda () (start-server'
This works — the web server responds properly, and the REPL sta
Maybe starting the server from the REPL is the better idea. Right now I do it
through raco (redirecting commands of form `raco pollen ...`, including `raco
pollen start`, to a special pollen/raco module that handles them)
On Aug 27, 2014, at 3:12 PM, Jay McCarthy wrote:
> Yes, although I actu
Yes, although I actually assumed that you would start your server from
a real Racket REPL, rather than implement your own REPL, so you
wouldn't need to wait on anything. But what you wrote will work too.
Jay
On Wed, Aug 27, 2014 at 4:33 PM, Matthew Butterick wrote:
> Helpful, thanks. I have my `
Helpful, thanks. I have my `serve/servlet` within a `start-server` function
rather than at the top level. Quick experimentation suggests that `thread-wait`
is needed in this case (?):
(define (start-server)
(setup-chores ...)
(define server-t (thread (lambda () (serve/servlet ...
Hi Matthew,
You can run serve/servlet in a separate thread and continue to
interact with any functions you want:
(define server-t (thread (lambda () (serve/servlet ...
You could then use something like xrepl to start doing new stuff.
There's nothing the Web server would need to do necessaril
The main engine of my Pollen system is a project webserver that's started from
the command line, uses serve/servlet, and sends the usual status & error
messages to the terminal window.
I was thinking it would be handy to be able to keep an input prompt in that
terminal window to be able to issu
t; button that allows the user to
>> drag&drop a file onto the button, and then hitting the button sends the file
>> to the server.
>>
>> Is there any way of doing this in a Racket web server? If not, how close
>> can we come?
>>
>> --Mitch
>>
>&
sends the
> file to the server.
>
> Is there any way of doing this in a Racket web server? If not, how close
> can we come?
>
> --Mitch
>
>
>
> Racket Users list:
> http://lists.racket-lang.org/users
>
>
Racket Users list:
http://lists.racket-lang.org/users
Many web pages have an "upload file" button that allows the user to
drag&drop a file onto the button, and then hitting the button sends the
file to the server.
Is there any way of doing this in a Racket web server? If not, how close
can we come?
--Mitch
Rac
At Thu, 17 Jul 2014 14:28:29 -0400, Brian Adkins wrote:
> On Jul 17, 2014, at 2:05 PM, Brian Adkins wrote:
> > On Jul 17, 2014, at 1:26 PM, Matthew Flatt wrote:
> >> We wanted to avoid multiple processes because OSes don't provide great
> >> facilities for managing them and communicating between th
On Thu, Jul 17, 2014 at 02:28:29PM -0400, Brian Adkins wrote:
> On Jul 17, 2014, at 2:05 PM, Brian Adkins wrote:
> > On Jul 17, 2014, at 1:26 PM, Matthew Flatt wrote:
> >> We wanted to avoid multiple processes because OSes don't provide great
> >> facilities for managing them and communicating betw
On Jul 17, 2014, at 2:05 PM, Brian Adkins wrote:
> On Jul 17, 2014, at 1:26 PM, Matthew Flatt wrote:
>> We wanted to avoid multiple processes because OSes don't provide great
>> facilities for managing them and communicating between them.
>
> Maybe I'm confused. I thought creating a new Place invo
On Jul 17, 2014, at 1:26 PM, Matthew Flatt wrote:
>> Is that not the case with Places? If so, what was the rationale in not
>> utilizing copy-on-write?
>
> Do you mean copy-on-write via processes and fork(), or somehow by
> itself?
Yes, separate processes w/ separate virtual memory but sharing s
At Thu, 17 Jul 2014 12:19:21 -0400, Brian Adkins wrote:
> I just read "Places: Adding Message-Passing Parallelism to Racket" and wanted
> to pass on a link to any other Racket newbies interested in parallelism:
>
> https://www.cs.utah.edu/plt/publications/dls11-tsffd.pdf
>
> This was good to rea
On 2014-07-17 12:19:21 -0400, Brian Adkins wrote:
> I just read "Places: Adding Message-Passing Parallelism to Racket" and
> wanted to pass on a link to any other Racket newbies interested in
> parallelism:
>
> https://www.cs.utah.edu/plt/publications/dls11-tsffd.pdf
Also, Matthew gave a talk on A
hare
>> continuations. It would be trivial to use serializable continuations
>> or to implement a continuation manager that stored all the
>> continuations in a single place. Session affinity doesn't really make
>> a lot of sense in the continuation context, fwiw.
>&g
tions. It would be trivial to use serializable continuations
> > or to implement a continuation manager that stored all the
> > continuations in a single place. Session affinity doesn't really make
> > a lot of sense in the continuation context, fwiw.
> >
> > My gue
ns, I thought it was important for all of a user's subsequent
requests to go to the same process that served the first request since there
would be state stored in the memory of the web server process.
Is that not the case? Or are all continuations serialized to disk so that any
Racket web
nd less than 100 lines to implement the
> continuation manager and the place-based worker setup. (This is based
> on the normal server setup just being 127 lines and the manager
> interface being implemented in as little as 40 lines.) This might be
> worth it.
>
> Jay
>
>
&
Thanks, I think we're on the same page.
I was considering something outside of the Racket web server handling the
affinity. For example, the nginx web server / load balancer being responsible
to send subsequent requests from a client to the same server process that
handled the initial re
irst request since there
> would be state stored in the memory of the web server process.
>
> Is that not the case? Or are all continuations serialized to disk so that any
> Racket web server process (assuming there are multiple instances running)
> could serve a subsequent request fo
and having
> something like nginx proxy to them works well to fully utilize all cores.
>
> I think I read that the Racket web server makes use of continuations, so I
> expect some sort of process affinity would be necessary, where a given user's
> requests are always proxie
I haven't looked into the Racket web server much yet, so I'd like to understand
the implications of this.
My experience is with stateless http app servers (primarily with Unicorn Ruby
servers at the moment), so firing up a number of worker processes and having
something like ngin
It does not use multiple cores if they are available.
Jay
On Wed, Jul 16, 2014 at 7:02 AM, Sean Kemplay wrote:
> Hello,
>
> I am interested in the racket web server for some micro services. Just
> wondering if by default it runs across multiple cores or if it is restricted
>
Hello,
I am interested in the racket web server for some micro services. Just
wondering if by default it runs across multiple cores or if it is
restricted to one due to threads in racket.
Regards,
Sean
Racket Users list:
http://lists.racket-lang.org/users
>
> current-servlet-continuation-expiration-handler receives the request
> (which contains request-uri) that expired. Is that all you want?
>
That's exactly what I was looking for. Thanks!
Tobias
>
> Jay
>
>
> On Wed, Feb 5, 2014 at 9:26 AM, Janos Tobias Locsei
> wrote:
> > Is there a way
I'm not sure what a "current url" would be, given that continuations
jump around the program and storing it would be mean you might have to
store everything about the request, which could be large if there is
data with it.
current-servlet-continuation-expiration-handler receives the request
(which
Is there a way for a function in the web server to find out the current url?
I'm using stateful servlets and I'd like to redirect to the start page of
my app if the continuation expires, using something along the lines of
(parameterize
([current-servlet-continuation-expiration-handler
])
"Hello world")
>> (img ([src "/puppy.jpg"] [alt "cute puppy"]))
>> ; puppy.jpg is located at D:/Tobias/server-root/htdocs/puppy.jpg
>> ; Image only displays if I use the leading forward slash like this
>>
>> (serve/servle
s/server-root/htdocs/puppy.jpg
> ; Image only displays if I use the leading forward slash like this
>
> (serve/servlet
> start
> #:server-root-path SOMEPATH
> )
>
> I noticed that the leading forward slash is used in the web applications
> tutorial of the racket documentation, e.g.
-lang.org/continue/
Tobias
On 28 January 2014 19:27, Matthew Butterick wrote:
> I've not experienced this issue with the Racket web server. When you
> append a leading forward slash to a URL, you're obviously telling the
> browser something completely different about where to f
I've not experienced this issue with the Racket web server. When you append
a leading forward slash to a URL, you're obviously telling the browser
something completely different about where to find the file. I would
suspect it has something to do with either file organization, Racket
I noticed that when using the racket web server one needs to include a
leading forward slash when referencing static files e.g. a style.css or an
image.jpg. Is there a rationale for this? It's different than the usual
html convention, and it means that when using html template files it&
Also, this produces an error saying it's an unknown module if it's a
local-require:
#lang racket
(module thing racket
(provide x)
(define x "something"))
(let ()
(local-require 'thing)
x)
;;=>
;; ../../Applications/Racket v5.3.4/collects/racket/private/
reqprov.rkt:1092:2: require: unkn
I also tried it with prefix-in and it worked:
#lang racket
(let ()
(local-require (prefix-in rkt: racket))
(rkt:string #\a #\b))
;;=> "ab"
On Nov 28, 2013, at 9:32 AM, Greg Hendershott wrote:
It looks like there's a corner case where `local-require` does not
work -- with non-simple require sp
Oops I left the other comment in. I meant:
I tried it with only-in instead of rename-in and it worked:
#lang racket
(let ()
(local-require (only-in racket [string rkt:string]))
(rkt:string #\a #\b))
;;=> "ab"
On Nov 28, 2013, at 8:50 PM, Alexander D. Knauth wrote:
I tried it with only-in in
I tried it with only-in instead of rename-in and it worked:
#lang racket
(let ()
(local-require (only-in racket [string rkt:string]))
;;=> 3:28: syntax: misplaced ellipsis in template at: ... in: ...
(rkt:string #\a #\b))
;;=> "ab"
On Nov 28, 2013, at 9:32 AM, Greg Hendershott wrote:
It look
It looks like there's a corner case where `local-require` does not
work -- with non-simple require specs such as `rename-in` or
`prefix-in`, AND where the module is the #lang module.
This works with normal require:
#lang racket
(require (rename-in racket [string rkt:string]))
(rkt:string #\a #\b)
First, local-require can only get phase-0 bindings.
Second, there is a slight code-size penalty if you look at the
expansion, because local-require lifts the require to the top-level
and then enumerates the phase-0 bindings with the same ids but the
lexical context of the local-require body.
As f
So I have a delayed-reaction question.
Why separate `require` and `local-require`?
It looks like `local-require` works at module level or top level; it
_seems_ equivalent to `require` there.
Why not just have `require` _be_ `local-require`?
Or is there some cost or penalty to `local-require` th
1 - 100 of 193 matches
Mail list logo