Re: [racket-users] Having trouble getting documentation to generate

2021-09-28 Thread Philip McGrath
On Tue, Sep 28, 2021 at 3:30 PM Ben Greenman 
wrote:

> On 9/28/21, David Storrs  wrote:
> > $ raco pkg remove try-catch
> > raco pkg remove: invalid `deps' specification
> >   specification: '("base" racket/format racket/string)
> >
> > That is not the deps specification from the info.rkt file so I don't know
> > where it's getting that.
>
> Some package somewhere must have that bad info.rkt file.
>

I'm not sure exactly what `raco pkg` should do when it encounters such an
error, but it probably shouldn't just leave you stuck with unwanted
erroneous packages forever.

I haven't tried `raco setup` to look at its output, but one possible
improvement would be for whatever code complains about the "invalid `deps'
specification" to always report the invalid file's path.

-Philip

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/0100017c2f6138bb-a571c1dd-eacf-4a18-8481-48f1a50dd0fa-00%40email.amazonses.com.


Re: [racket-users] Having trouble getting documentation to generate

2021-09-28 Thread Robby Findler
I'm not quite following from the thread, but it sure sounds like there is a
bug in raco setup (or similar) somewhere that isn't reporting an error
properly. Is that the case?

Robby


On Tue, Sep 28, 2021 at 4:12 PM David Storrs  wrote:

>
>
> On Tue, Sep 28, 2021 at 3:30 PM Ben Greenman 
> wrote:
>
>> On 9/28/21, David Storrs  wrote:
>>
>> > Also, any ideas on why the remove fails?
>> >
>> > $ raco pkg remove try-catch
>> > raco pkg remove: invalid `deps' specification
>> >   specification: '("base" racket/format racket/string)
>> >
>> > That is not the deps specification from the info.rkt file so I don't
>> know
>> > where it's getting that.
>>
>> Some package somewhere must have that bad info.rkt file.
>>
>> A plain "raco setup" might be the quickest way to find the bad one.
>> That should print the name of every package as it goes through them.
>
>
> It did show them right up to the point where it bonked but did not show
> the name of the one it bonked on.  Fortunately, since you told me what the
> issue was I was able to find it with a simple:
>
> $ find . -name official-racket -prune -o -name info.rkt -exec grep -l
> 'racket/format' \{} \;
>
> Thanks!
>
>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Racket Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to racket-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/racket-users/CAFUu9R5%3DCL-_wfB52aG82Vg9y%2B9HKpQhxk_dX08ub5Ln948QGQ%40mail.gmail.com
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to racket-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/racket-users/CAE8gKoevcaM26JaaBYVZCORxsXJXVUO9zZNJYR2UPcH_94Rb8Q%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CAL3TdOP9gkGbi%3DnN7s1SeTTDebpFU1wxt1a%2BYaR6L_1xPwPzMQ%40mail.gmail.com.


Re: [racket-users] Having trouble getting documentation to generate

2021-09-28 Thread David Storrs
On Tue, Sep 28, 2021 at 3:30 PM Ben Greenman 
wrote:

> On 9/28/21, David Storrs  wrote:
>
> > Also, any ideas on why the remove fails?
> >
> > $ raco pkg remove try-catch
> > raco pkg remove: invalid `deps' specification
> >   specification: '("base" racket/format racket/string)
> >
> > That is not the deps specification from the info.rkt file so I don't know
> > where it's getting that.
>
> Some package somewhere must have that bad info.rkt file.
>
> A plain "raco setup" might be the quickest way to find the bad one.
> That should print the name of every package as it goes through them.


It did show them right up to the point where it bonked but did not show the
name of the one it bonked on.  Fortunately, since you told me what the
issue was I was able to find it with a simple:

$ find . -name official-racket -prune -o -name info.rkt -exec grep -l
'racket/format' \{} \;

Thanks!


> --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to racket-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/racket-users/CAFUu9R5%3DCL-_wfB52aG82Vg9y%2B9HKpQhxk_dX08ub5Ln948QGQ%40mail.gmail.com
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CAE8gKoevcaM26JaaBYVZCORxsXJXVUO9zZNJYR2UPcH_94Rb8Q%40mail.gmail.com.


Re: [racket-users] Having trouble getting documentation to generate

2021-09-28 Thread Ben Greenman
On 9/28/21, David Storrs  wrote:
> *fists of rage*
>
> I'm glad it worked for you, and that it works for me if I repeat your
> steps.  I have no idea why it wasn't working given that I was using the
> local copy of the git repository that is the source of what's on github.
> Argh.

Weird ... glad it's working.

> Regardless, thank you very much for your help.  I've fixed the (for-label
> try-catch), removed the test-more dependency, pushed it to github, and told
> the package server to rescan.  It says it will do that 1 minute from now,
> so hopefully it'll be good to go at that point.  I think documentation only
> gets generated once per day though, right?
>
>
> Also, any ideas on why the remove fails?
>
> $ raco pkg remove try-catch
> raco pkg remove: invalid `deps' specification
>   specification: '("base" racket/format racket/string)
>
> That is not the deps specification from the info.rkt file so I don't know
> where it's getting that.

Some package somewhere must have that bad info.rkt file.

A plain "raco setup" might be the quickest way to find the bad one.
That should print the name of every package as it goes through them.

Or, a "raco pkg remove -f try-catch" should work despite the invalid deps spec.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CAFUu9R5%3DCL-_wfB52aG82Vg9y%2B9HKpQhxk_dX08ub5Ln948QGQ%40mail.gmail.com.


[racket-users] [ANN] try-catch - exception handling with dynamic-wind guarantees

2021-09-28 Thread David Storrs
Module name:  try-catch
https://pkgd.racket-lang.org/pkgn/package/try-catch

Lisp stereotypically has a problem that it's super easy to write your own
code so the library ecosystem ends up fractured, with multiple options to
do the same thing.  McCarthy forbid that I should break the stereotype, so
here's my entry into the try/catch niche.

> (try [shared (define username "bob")]
   [pre (printf "in pre, prepping to handle ~a.\n" username)]
   [(printf "in body. hello, ~a.\n" username)]
   [post (printf "in post, goodbye ~a.\n" username)]
   [catch (symbol? (printf "the symbol was ~a\n" e))]
   [cleanup (printf "in cleanup, done with ~a." username)])
in pre, prepping to handle bob.
in body. hello, bob.
in post, goodbye bob.
in cleanup, done with bob.


pre/body/post are plugged into a dynamic-wind, meaning that the pre clause
is executed before body whenever control enters the body (either normally
or through a continuation jump or etc) and the post clause is executed
whenever control leaves the body.

The catch clause contains subclauses of (predicate handler-expr) that get
fed into a with-handlers, except the handler-exprs are wrapped in a (lambda
(e) ...) in order to reduce boilerplate.  The value 'e' is available to the
handler-expr.

The shared clause does setup before the pre/body are called and the code in
that clause is visible to all subsequent clauses.

The cleanup clause is run iff the body exits without error.

See the documentation for full details and examples.  (Note that the
package server is not currently admitting that there is documentation but
there will be when you install it.)

Competing options:

try  (Typed Racket):  https://pkgs.racket-lang.org/package/try
try-catch-finally and try-catch-finally-lib:
https://pkgs.racket-lang.org/package/try-catch-finally and
https://pkgs.racket-lang.org/package/try-catch-finally-lib
try-catch-match: https://pkgs.racket-lang.org/package/try-catch-match
try-make-sarna-happy:
https://pkgs.racket-lang.org/package/try-make-sarna-happy

My motivation for writing this instead of submitting pull requests was in
part syntactic (the other libraries all use (catch ...) for each of the
catch clauses and I dispreferred the redundancy of typing 'catch' over and
over) and in part because I wanted the 'shared' and 'cleanup' phases which
would have required greater changes to their macros than I was comfortable
submitting.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CAE8gKoeQXhhKatZzjMePd_qbqiNPBOeyX%3DsMqisAVateOBVKrQ%40mail.gmail.com.


Re: [racket-users] [ANN] fmt: a Racket code formatter

2021-09-28 Thread David Storrs
This is very cool, Sorawee.  Thank you for sharing.

On Tue, Sep 28, 2021 at 2:03 PM Sorawee Porncharoenwase <
sorawee.pw...@gmail.com> wrote:

> Announcing the pre-alpha version of fmt, a Racket code formatter. Code
> formatter is a tool that reformats your code so that it conforms to a style
> consistently.
>
>- Source: https://github.com/sorawee/fmt/
>- Documentation and demo: https://docs.racket-lang.org/fmt/
>
> As a part of this work, I implemented Jean-Philippe Bernady’s non greedy
> pretty printer  (ICFP’17) and
> extended it so that it is practical for actual use.
>
>- Source: https://github.com/sorawee/pprint-compact/
>- Documentation and demo: https://docs.racket-lang.org/pprint-compact/
>
> Hope you find these useful, and let me know if you have any feedback.
>
> Sorawee (Oak)
>
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to racket-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/racket-users/CADcueguOiOBK4vE3kCfvWYkb2Eaz-JfM5_Yd%3DGct-6umSUEG6w%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CAE8gKodp-Cy3L%2BX%3DH8fSYZwtqLPVFZJVESRp_nOeV7VY_OM8zQ%40mail.gmail.com.


Re: [racket-users] Having trouble getting documentation to generate

2021-09-28 Thread David Storrs
*fists of rage*

I'm glad it worked for you, and that it works for me if I repeat your
steps.  I have no idea why it wasn't working given that I was using the
local copy of the git repository that is the source of what's on github.
Argh.

Regardless, thank you very much for your help.  I've fixed the (for-label
try-catch), removed the test-more dependency, pushed it to github, and told
the package server to rescan.  It says it will do that 1 minute from now,
so hopefully it'll be good to go at that point.  I think documentation only
gets generated once per day though, right?


Also, any ideas on why the remove fails?

$ raco pkg remove try-catch
raco pkg remove: invalid `deps' specification
  specification: '("base" racket/format racket/string)

That is not the deps specification from the info.rkt file so I don't know
where it's getting that.


On Tue, Sep 28, 2021 at 1:36 PM Ben Greenman 
wrote:

> On 9/28/21, David Storrs  wrote:
> > Summary:  Documentation for a new module is not being generated when I
> > would expect it to be and when I do it manually it ends up not linking
> > basic Racket items.  I've done a lot of searching to figure it out and
> > would appreciate some help.
>
> I cloned the try-catch repo (744f217), ran raco pkg install, and got a
> nicely-rendered document. Log attached.
>
> The only problem I saw is that `try` isn't linked. You can fix that by
> adding a `(require (for-label try-catch))`.
>
>
> > Long version:
> >
> > I published a module a few days ago called try-catch.  I have an announce
> > email written up for it but I was waiting for the documentation to
> generate
> > before sending.  It still hasn't generated so today I investigated.
> >
> > First thing I did was make sure that raco was using the local copy for
> > everything:
> >
> > $ raco pkg remove try-catch
> > raco pkg remove: invalid `deps' specification
> >   specification: '("base" racket/format racket/string)
> >
> > Weird.
> >
> > $ raco setup --check-pkg-deps try-catch
> > [...lots of stuff, no problems reported]
> >
> > Okay, whatever.
> >
> > $ raco pkg remove --force try-catch
> >
> > Turn off the WiFi to be certain I don't get the package server version.
> >
> > $ raco pkg install ./try-catch
> >
> > Succeeds, claims that it is building the documentation, does not actually
> > do so.  Ditto when I try
> >
> > $ raco setup try-catch
> >
> > When I manually run
> >
> > $ cd try-catch/scribblings/ && scribble try-catch.scbl
> >
> > I get the try-catch.html file as expected but racket/base functions such
> as
> > with-handlers are not properly linked -- i.e. they appear in blue with a
> > red line under them and are not links.
>
> That's normal. Scribble needs a few command-line flags to know where
> to look for cross references (xrefs). I don't know the right flags
> offhand.
>
>
> > I do not get any missing dependencies when I run
> >
> > My info.rkt file and try-catch.scrbl are both based on those from other
> > modules I have that do work correctly.  I've checked the issues that were
> > pointed out to me the last time I had to ask this question, I've been
> > through the Racket documentation and through Beautiful Racket, and still
> > not found the answer.  Any suggestions?
> >
> >
> > ;; The info.rkt file
> > #lang info
> >
> > (define collection "try-catch")
> > (define version "0.1")
> > (define deps '("base"
> >"syntax-classes-lib"))
> >
> > (define scribblings '(("scribblings/try-catch.scrbl" (
> >
> > (define test-omit-paths '())
> > (define build-deps '("racket-doc"
> >  "scribble-lib"
> >  "rackunit-lib"
> >  "sandbox-lib"))
> >
> > ;;--
> > ;;  The top lines from main.rkt to show the require:
> >
> > #lang racket/base
> >
> > (require (for-syntax racket/base
> >  syntax/parse)
> >  racket/function)
> >
> > ;;--
> > ;; A stripped-down version of scribblings/try-catch.scrbl that
> demonstrates
> > the failures
> >
> > #lang scribble/manual
> >
> > @(require (for-label racket)
> >   racket/sandbox
> >   scribble/example)
> >
> > @defmodule[try-catch]
> >
> > @(define eval
> >(call-with-trusted-sandbox-configuration
> > (lambda ()
> >   (parameterize ([sandbox-output 'string]
> >  [sandbox-error-output 'string]
> >  [sandbox-memory-limit 50])
> > (make-evaluator 'racket)
> >
> > @itemlist[
> > @item{@racket[with-handlers], @racket[~a], @racketmodname[syntax-parse]}
> > ]
> >
> > @examples[
> >   #:eval eval
> >   #:label #f
> >
> > (require try-catch)
> > (define err (defatalize (raise-arguments-error 'foo "failed")))
> > err
> > (try [(displayln "ok")])
> > ]
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Racket Users" group.
> > To unsubscribe from this group and stop receiving emails from it, send an
> > email to 

[racket-users] [ANN] fmt: a Racket code formatter

2021-09-28 Thread Sorawee Porncharoenwase
Announcing the pre-alpha version of fmt, a Racket code formatter. Code
formatter is a tool that reformats your code so that it conforms to a style
consistently.

   - Source: https://github.com/sorawee/fmt/
   - Documentation and demo: https://docs.racket-lang.org/fmt/

As a part of this work, I implemented Jean-Philippe Bernady’s non greedy
pretty printer  (ICFP’17) and
extended it so that it is practical for actual use.

   - Source: https://github.com/sorawee/pprint-compact/
   - Documentation and demo: https://docs.racket-lang.org/pprint-compact/

Hope you find these useful, and let me know if you have any feedback.

Sorawee (Oak)

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CADcueguOiOBK4vE3kCfvWYkb2Eaz-JfM5_Yd%3DGct-6umSUEG6w%40mail.gmail.com.


Re: [racket-users] Having trouble getting documentation to generate

2021-09-28 Thread Sorawee Porncharoenwase
>
> When I manually run
>
> $ cd try-catch/scribblings/ && scribble try-catch.scbl
>
> I get the try-catch.html file as expected but racket/base functions such
> as with-handlers are not properly linked -- i.e. they appear in blue with a
> red line under them and are not links.
>

   - As I understand, if you run scribble manually, you need to provide
   additional flags to make links work. I never remember what these flags are
   (perhaps +m?). But if you run Scribble via DrRacket, it should include
   these flags for you automatically.
   - But you can also just view the already rendered docs via raco docs
   try-catch. No need to use scribble again — it’s already run as a
part of raco
   setup. You can re-render it via raco setup. I like this way far better
   since the scribble command generates so many files in the source
   directory that I would need to add to .gitignore (I know --dest exists,
   but I usually forgot to provide it),  but raco setup generates the
   rendered doc either elsewhere or in doc directory, which can be added in
   .gitignore easily (actually it's already in gitignore if you use raco
   pkg new command).

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CADcueguB8du0ez9f3USQYo-BRDP-xpFL-SKzdJa6fVx3CZO33A%40mail.gmail.com.


Re: [racket-users] Having trouble getting documentation to generate

2021-09-28 Thread Ben Greenman
On 9/28/21, David Storrs  wrote:
> Summary:  Documentation for a new module is not being generated when I
> would expect it to be and when I do it manually it ends up not linking
> basic Racket items.  I've done a lot of searching to figure it out and
> would appreciate some help.

I cloned the try-catch repo (744f217), ran raco pkg install, and got a
nicely-rendered document. Log attached.

The only problem I saw is that `try` isn't linked. You can fix that by
adding a `(require (for-label try-catch))`.


> Long version:
>
> I published a module a few days ago called try-catch.  I have an announce
> email written up for it but I was waiting for the documentation to generate
> before sending.  It still hasn't generated so today I investigated.
>
> First thing I did was make sure that raco was using the local copy for
> everything:
>
> $ raco pkg remove try-catch
> raco pkg remove: invalid `deps' specification
>   specification: '("base" racket/format racket/string)
>
> Weird.
>
> $ raco setup --check-pkg-deps try-catch
> [...lots of stuff, no problems reported]
>
> Okay, whatever.
>
> $ raco pkg remove --force try-catch
>
> Turn off the WiFi to be certain I don't get the package server version.
>
> $ raco pkg install ./try-catch
>
> Succeeds, claims that it is building the documentation, does not actually
> do so.  Ditto when I try
>
> $ raco setup try-catch
>
> When I manually run
>
> $ cd try-catch/scribblings/ && scribble try-catch.scbl
>
> I get the try-catch.html file as expected but racket/base functions such as
> with-handlers are not properly linked -- i.e. they appear in blue with a
> red line under them and are not links.

That's normal. Scribble needs a few command-line flags to know where
to look for cross references (xrefs). I don't know the right flags
offhand.


> I do not get any missing dependencies when I run
>
> My info.rkt file and try-catch.scrbl are both based on those from other
> modules I have that do work correctly.  I've checked the issues that were
> pointed out to me the last time I had to ask this question, I've been
> through the Racket documentation and through Beautiful Racket, and still
> not found the answer.  Any suggestions?
>
>
> ;; The info.rkt file
> #lang info
>
> (define collection "try-catch")
> (define version "0.1")
> (define deps '("base"
>"syntax-classes-lib"))
>
> (define scribblings '(("scribblings/try-catch.scrbl" (
>
> (define test-omit-paths '())
> (define build-deps '("racket-doc"
>  "scribble-lib"
>  "rackunit-lib"
>  "sandbox-lib"))
>
> ;;--
> ;;  The top lines from main.rkt to show the require:
>
> #lang racket/base
>
> (require (for-syntax racket/base
>  syntax/parse)
>  racket/function)
>
> ;;--
> ;; A stripped-down version of scribblings/try-catch.scrbl that demonstrates
> the failures
>
> #lang scribble/manual
>
> @(require (for-label racket)
>   racket/sandbox
>   scribble/example)
>
> @defmodule[try-catch]
>
> @(define eval
>(call-with-trusted-sandbox-configuration
> (lambda ()
>   (parameterize ([sandbox-output 'string]
>  [sandbox-error-output 'string]
>  [sandbox-memory-limit 50])
> (make-evaluator 'racket)
>
> @itemlist[
> @item{@racket[with-handlers], @racket[~a], @racketmodname[syntax-parse]}
> ]
>
> @examples[
>   #:eval eval
>   #:label #f
>
> (require try-catch)
> (define err (defatalize (raise-arguments-error 'foo "failed")))
> err
> (try [(displayln "ok")])
> ]
>
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to racket-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/racket-users/CAE8gKoforSuxKVGwj2E_T-_HhLafaFipRGqERh6QUvyn6%2B9MUg%40mail.gmail.com.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CAFUu9R5%2B%3DbdPTXwrNgu1ZKfjzRSOYy03FmMAiRN%2Br2o3DEyoUA%40mail.gmail.com.
> git clone https://github.com/dstorrs/try-catch
Cloning into 'try-catch'...
remote: Enumerating objects: 18, done.
remote: Counting objects: 100% (18/18), done.
remote: Compressing objects: 100% (12/12), done.
remote: Total 18 (delta 4), reused 18 (delta 4), pack-reused 0
Unpacking objects: 100% (18/18), done.
> cd try-catch
> ls
LICENSE info.rktmain.rktscribblings
> raco pkg install
Linking current directory as a package
The following uninstalled packages are listed as dependencies of try-catch:
   test-more
Would you like to install these 

[racket-users] Having trouble getting documentation to generate

2021-09-28 Thread David Storrs
Summary:  Documentation for a new module is not being generated when I
would expect it to be and when I do it manually it ends up not linking
basic Racket items.  I've done a lot of searching to figure it out and
would appreciate some help.

Long version:

I published a module a few days ago called try-catch.  I have an announce
email written up for it but I was waiting for the documentation to generate
before sending.  It still hasn't generated so today I investigated.

First thing I did was make sure that raco was using the local copy for
everything:

$ raco pkg remove try-catch
raco pkg remove: invalid `deps' specification
  specification: '("base" racket/format racket/string)

Weird.

$ raco setup --check-pkg-deps try-catch
[...lots of stuff, no problems reported]

Okay, whatever.

$ raco pkg remove --force try-catch

Turn off the WiFi to be certain I don't get the package server version.

$ raco pkg install ./try-catch

Succeeds, claims that it is building the documentation, does not actually
do so.  Ditto when I try

$ raco setup try-catch

When I manually run

$ cd try-catch/scribblings/ && scribble try-catch.scbl

I get the try-catch.html file as expected but racket/base functions such as
with-handlers are not properly linked -- i.e. they appear in blue with a
red line under them and are not links.

I do not get any missing dependencies when I run

My info.rkt file and try-catch.scrbl are both based on those from other
modules I have that do work correctly.  I've checked the issues that were
pointed out to me the last time I had to ask this question, I've been
through the Racket documentation and through Beautiful Racket, and still
not found the answer.  Any suggestions?


;; The info.rkt file
#lang info

(define collection "try-catch")
(define version "0.1")
(define deps '("base"
   "syntax-classes-lib"))

(define scribblings '(("scribblings/try-catch.scrbl" (

(define test-omit-paths '())
(define build-deps '("racket-doc"
 "scribble-lib"
 "rackunit-lib"
 "sandbox-lib"))

;;--
;;  The top lines from main.rkt to show the require:

#lang racket/base

(require (for-syntax racket/base
 syntax/parse)
 racket/function)

;;--
;; A stripped-down version of scribblings/try-catch.scrbl that demonstrates
the failures

#lang scribble/manual

@(require (for-label racket)
  racket/sandbox
  scribble/example)

@defmodule[try-catch]

@(define eval
   (call-with-trusted-sandbox-configuration
(lambda ()
  (parameterize ([sandbox-output 'string]
 [sandbox-error-output 'string]
 [sandbox-memory-limit 50])
(make-evaluator 'racket)

@itemlist[
@item{@racket[with-handlers], @racket[~a], @racketmodname[syntax-parse]}
]

@examples[
  #:eval eval
  #:label #f

(require try-catch)
(define err (defatalize (raise-arguments-error 'foo "failed")))
err
(try [(displayln "ok")])
]

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CAE8gKoforSuxKVGwj2E_T-_HhLafaFipRGqERh6QUvyn6%2B9MUg%40mail.gmail.com.


[racket-users] Re: Strange readline/racket-mode behavior

2021-09-28 Thread Tony Garnock-Jones
Hi Winston,

I've submitted a suggested improvement to interactive REPLish behaviour 
around read-char and read-line here: 
https://github.com/racket/racket/pull/4007

Please let me know if it improves the situation for you. And of course, if 
anyone else has comments about this kind of thing, please let me know!

Here's the commit comment explaining a little more of the situation:

`winny` on IRC (and subsequently on the mailing list [1]) remarked
that, at the REPL,

```racket
Welcome to Racket v8.2.0.8 [cs].
> (read-line)
""
>
```

which is surprising, since it didn't appear to wait for a line of
input.

Guile does this differently, with its `read-eval-print-loop`
apparently consuming any whitespace after the `read` expression and
before starting the `eval`.

This patch performs a similar trick. In *interactive* contexts
(namely, by action of the default `current-read-interaction`), if
`read-syntax` answers non-`eof`, a procedure
`discard-line-terminators` peeks for and consumes a *single* CR, LF or
CRLF line terminator.

Non-interactive contexts are not affected.

This is very much a special-case in order to improve user experience:
I feel like, because it's an amendment to the REPL and the top-level
is hopeless [2], it's fair game to introduce exceptional handling like
this.

[1]: https://groups.google.com/g/racket-users/c/qUIFqWkkvFs/m/AERXYmfGBgAJ
[2]: https://gist.github.com/samth/3083053

Cheers,
  Tony

On Friday, September 24, 2021 at 9:01:37 PM UTC+2 cr5...@gmail.com wrote:

> Hey everyone,
>
> I was working on a procedure to prompt the user for confirmation and found
> something a bit strange - it did not appear to read for input when usingt
> "racket -i" or in the Emacs Racket REPL buffer. Here is the code:
>
> (define (yn #:read-one-char? [read-one-char? #f])
> (display "y/n: ")
> (flush-output (current-output-port))
> (if read-one-char?
> (match (read-char)
> [(or #\y #\Y) #t]
> [m #f])
> (match (read-line)
> [(or "y" "Y") #t]
> [m #f])))
>
> Regardless if I use read-char or read-line and type y or Y, the behavior 
> seeims
> similar, each of the match's second clause is followed because (read-char)
> returns #\newline whereas read-line returns "" (empty string).
>
> I mentioned this strange behavior on the Libera chat and got an 
> enlightening
> response from tonyg outlining what is happening:
>
> > at the repl, if you type "(read-char)" and press enter, the reader sees 
> ( r e
> > a d - c h a r ) NEWLINE. When it gets to the close-parenthesis, it 
> executes
> > the expression, which reads the NEWLINE character and returns. Similar 
> for
> > read-line, where it sees NEWLINE and returns an empty line
> >
> > try typing (list (read-line) (read-line))
>
> I can confirm tonyg's solution works. The (list (read-char) (read-char)) 
> also
> appears to work, though one always has to type a final newline to send the
> line-buffered input.
>
> The behavior feels very surprising and took me a bit of time to figure out,
> even then I didn't really understand it so I had to ask for help. Can this
> behavior be changed in a future release? Is a reasonable request or could 
> this
> break a lot of code? If this could break stuff, is it worth doing changing 
> it
> anyway, so the behavior is less surprising? I hope to understand if it's
> agreeable to make a PR for this change before investing the time.
>
> Keep on Racketing!
>
> Winston Weinert
> winny.tech
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/c48a0f87-92f8-46b1-baae-6c6813f21337n%40googlegroups.com.