[racket-users] [racket][draw] some APIs should be more open

2017-04-11 Thread WarGrey Gyoudmon Ju
This is a little awkward, there are lots of simple classes defined in
racket/draw, font%, color%, pen%, brush% and so on. They just hold a group
of plain data, hence opportunities to be inspected easily. However by
default all classes are opaque, the easiest (and perhaps unique) way to
handle this is to inherit them and implement the `printable<%>` or
`writable<%>`.

Despite the wordy code and wasting little runtime space, the major problem
is all those classes hide their (set-immutable) methods, even worse, the
immutability is checked through the private field. As a consequence,
subclasses of Pen% and Brush% copy color instances every time to make them
immutable (and opaque) again...

So is it okay to open that interface?
Besides, With a long term plan, I want to improve the font infrastructure,
meanwhile maybe font% also should provide a (get-handler) or (get-desc).

-- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Package documentation link issue

2017-04-11 Thread Matthew Flatt
It's a bug in the pkg-build process, and I should have it fixed for the
next build.

At Tue, 11 Apr 2017 18:11:08 -0400, Tony Garnock-Jones wrote:
> Thanks, Philip -- that could well be a bug in the catalog UI. I can't
> check it out until after the OOPSLA deadline, so I've filed
> https://github.com/tonyg/racket-pkg-website/issues/42 to keep track of
> it until then.
> 
> Regards,
>   Tony
> 
> 
> On 04/11/2017 01:21 PM, Philip McGrath wrote:
> > I recently posted a package "recaptcha", and I noticed a problem with
> > the documentation link that I'm not sure how to fix. Google stylizes the
> > name as reCAPTCHA, and I've capitalized it that way in the title of the
> > documentation, but I called the actual package "recaptcha" so that you
> > can "raco pkg install recaptcha" and "(require recaptcha)" as Racketeers
> > would expect.
> > 
> > The link from docs.racket-lang.org 
> > correctly points to http://docs.racket-lang.org/reCAPTCHA/index.html;
> > however, from http://pkgs.racket-lang.org, the link points
> > to http://docs.racket-lang.org/recaptcha/index.html, which shows a 404
> > error page. Is there something I need to specify in the package metadata
> > to make this work correctly? Or is this a problem with the catalog?
> > 
> > Thanks,
> > 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
> > .
> > For more options, visit https://groups.google.com/d/optout.
> 
> -- 
> 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.
> For more options, visit https://groups.google.com/d/optout.

-- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Package documentation link issue

2017-04-11 Thread Tony Garnock-Jones
Thanks, Philip -- that could well be a bug in the catalog UI. I can't
check it out until after the OOPSLA deadline, so I've filed
https://github.com/tonyg/racket-pkg-website/issues/42 to keep track of
it until then.

Regards,
  Tony


On 04/11/2017 01:21 PM, Philip McGrath wrote:
> I recently posted a package "recaptcha", and I noticed a problem with
> the documentation link that I'm not sure how to fix. Google stylizes the
> name as reCAPTCHA, and I've capitalized it that way in the title of the
> documentation, but I called the actual package "recaptcha" so that you
> can "raco pkg install recaptcha" and "(require recaptcha)" as Racketeers
> would expect.
> 
> The link from docs.racket-lang.org 
> correctly points to http://docs.racket-lang.org/reCAPTCHA/index.html;
> however, from http://pkgs.racket-lang.org, the link points
> to http://docs.racket-lang.org/recaptcha/index.html, which shows a 404
> error page. Is there something I need to specify in the package metadata
> to make this work correctly? Or is this a problem with the catalog?
> 
> Thanks,
> 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
> .
> For more options, visit https://groups.google.com/d/optout.

-- 
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.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Package documentation link issue

2017-04-11 Thread Philip McGrath
I recently posted a package "recaptcha", and I noticed a problem with the
documentation link that I'm not sure how to fix. Google stylizes the name
as reCAPTCHA, and I've capitalized it that way in the title of the
documentation, but I called the actual package "recaptcha" so that you can
"raco pkg install recaptcha" and "(require recaptcha)" as Racketeers would
expect.

The link from docs.racket-lang.org correctly points to
http://docs.racket-lang.org/reCAPTCHA/index.html; however, from
http://pkgs.racket-lang.org, the link points to
http://docs.racket-lang.org/recaptcha/index.html, which shows a 404 error
page. Is there something I need to specify in the package metadata to make
this work correctly? Or is this a problem with the catalog?

Thanks,
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.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Names for flat-contract-with-explanation contracts

2017-04-11 Thread Philip McGrath
Is it possible to give a name to a contract created with
contract-with-explanation?

To illustrate, this example:

> #lang racket
> (define has-explanation/c
>   (flat-contract-with-explanation
>(λ (val)
>  (λ (blame)
>(raise-blame-error blame val
>   '(expected:
> "nothing would pass this"
> given: "~e")
>   val)
> (define/contract sample-violation
>   has-explanation/c
>   42)

prints this error message:

> sample-violation: broke its own contract
>   promised: nothing would pass this
>   produced: 42
>   in: anonymous-flat-contract
>   contract from: (definition sample-violation)
>   blaming: (definition sample-violation)
>(assuming the contract is correct)

which is wonderful, except for the "anonymous-flat-contract" part.

If I try to give it a name with rename-contract, it loses the custom error
reporting: e.g. this example:

> (define/contract sample-violation/renamed
>   (rename-contract has-explanation/c
>'renamed:has-explanation/c)
>   42)

prints this:

> sample-violation/renamed: broke its own contract
>   promised: renamed:has-explanation/c
>   produced: 42
>   in: renamed:has-explanation/c
>   contract from:
>   (definition sample-violation/renamed)
>   blaming: (definition sample-violation/renamed)
>(assuming the contract is correct)


The same thing happens with flat-named-contract: e,g, this

> (define/contract sample-violation/flat-named
>   (flat-named-contract 'flat-named:has-explanation/c
>has-explanation/c)
>   42)

prints this:

> sample-violation/flat-named: broke its own contract
>   promised: flat-named:has-explanation/c
>   produced: 42
>   in: flat-named:has-explanation/c
>   contract from:
>   (definition sample-violation/flat-named)
>   blaming: (definition sample-violation/flat-named)
>(assuming the contract is correct)

-- 
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.
For more options, visit https://groups.google.com/d/optout.