Re: [racket-dev] toward a new Racket macro expander

2015-02-26 Thread Anthony Carrico
On 02/26/2015 12:26 PM, Matthew Flatt wrote:
 Here's a report on my current experiment:
 
  http://www.cs.utah.edu/~mflatt/scope-sets/

The utah.edu admins start to panic, suspecting an in progress dos
attack, but it is just ~mflatt getting slashdoted...

-- 
Anthony Carrico


-- 
You received this message because you are subscribed to the Google Groups 
Racket Developers group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-dev+unsubscr...@googlegroups.com.
To post to this group, send email to racket-...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-dev/54EF8C79.104%40memebeam.org.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: OpenPGP digital signature


Re: [racket-dev] toward a new Racket macro expander

2015-02-26 Thread David Vanderson


On 02/26/2015 12:26 PM, Matthew Flatt wrote:

I've been working on a new macro expander for Racket, and I'm starting
to think that it will work. The new expander is not completely
compatible with the current expander --- and that will be an issue if
we eventually go forward with the change --- but most existing code
still works.

Here's a report on my current experiment:

  http://www.cs.utah.edu/~mflatt/scope-sets/


The goals for a new expander are

  1. to replace a complicated representation of syntax objects with a
 simpler one (and, as a result, avoid some performance and
 submodule-re-expansion problems that have been too difficult to fix
 with the current expander);

  2. to find a simpler model of binding than the current one, so that
 it's easier to explain and reason about scope and macros; and

  3. to implement the new expander in Racket instead of C.

I have possibly succeeded on 1, possibly succeeded to some degree on 2,
and temporarily given up on 3.

Thank you!  I'm still trying to understand how the current expansion 
process works.  This seems easier to reason about, so for me you're 
hitting goal 2.  And the comparison is helping me understand the current 
process as well.


Thanks,
Dave

--
You received this message because you are subscribed to the Google Groups Racket 
Developers group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-dev+unsubscr...@googlegroups.com.
To post to this group, send email to racket-...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-dev/54EFEA63.6040900%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-dev] Racket compiler in Racket

2015-02-18 Thread Gustavo Massaccesi
Ok, thanks. I´ll submit it in a few days.

Gustavo

On Wed, Feb 18, 2015 at 1:13 AM, Leif Andersen l...@leifandersen.net wrote:
 Hello,

 I am working on porting the racket compiler to racket. But it still has a
 bit to go and I have not yet ported the optimizer. So go right ahead.

 Thank you.


 ~Leif Andersen

 On Sun, Feb 15, 2015 at 1:36 PM, Gustavo Massaccesi gust...@oma.org.ar
 wrote:

 There is project to rewrite the Racket compiler in Racket. I'd like to
 know if it has advanced. In particular, if it's still possible to make
 big changes to the C code or it's better to wait and keep the code
 almost frozen.

 I'm planning to do few refactoring an improvements in the optimizer
 functions that handle predicates (for example expr_implies_predicate
 and check_known2_pred). The changes are small enough to be implemented
 in a pair of days (if I find no surprises) but they are big enough to
 be painful to port if the code is already translated.

 Gustavo

 --
 You received this message because you are subscribed to the Google Groups
 Racket Developers group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to racket-dev+unsubscr...@googlegroups.com.
 To post to this group, send email to racket-...@googlegroups.com.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/racket-dev/CAPaha9MMSSNLL-30%2B5bUzKgMb8qERN-%3DEOikEV%2B8ySoHcdzSeQ%40mail.gmail.com.
 For more options, visit https://groups.google.com/d/optout.



-- 
You received this message because you are subscribed to the Google Groups 
Racket Developers group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-dev+unsubscr...@googlegroups.com.
To post to this group, send email to racket-...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-dev/CAPaha9N17sf20SJS%2B3ugjXCYzdqZU_Wrzd8AtPasbg76jvNspw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-dev] make --clone installed pkgs

2015-02-18 Thread Matthew Flatt
At Tue, 17 Feb 2015 19:59:38 -0500, Sam Tobin-Hochstadt wrote:
 On Tue, Feb 17, 2015 at 6:41 PM, Matthew Flatt mfl...@cs.utah.edu wrote:
  At Tue, 17 Feb 2015 14:12:54 -0500, Sam Tobin-Hochstadt wrote:
  Does another system have a Racket-like in-place option (that works
  better)?
 
 I haven't used it, but GHC has an in-place build option where you can
 install packages; see [1].

I don't have a lot of experience with GHC, but I have talked to some
GHC and Cabal developers about how they work with the package system.
Those discussions did not lead me to believe that they have an
especially smooth system for working with packages and updates in-place
--- and, in particular, that it's not the way they normally work. I'd
be happy to hear more from someone who routinely works that way with
GHC, though.

 I think the closer analogy is to what other software does when you run
 both `make` and `make install` analagous to Racket's unix-style
 installation, since that's the recommended way of building (eg
 Python), just as in-place is the recommended way of building Racket
 from source. I don't think any of those systems update packages when
 running `make install`.

I'm not sure what you're getting at here. We seem to agree that the
usual `make` plus `make install` is like Racket's `make unix-style`,
neither of which updates packages (other than the ones the makefile
knows about).


  At Tue, 17 Feb 2015 17:40:36 -0500, Matthias Felleisen wrote:
  Speaking as the user I am, I really like it that make updates
  my extra-pkgs.
 
  Package scope provides one a way to get these different behaviors. The
  current `make` updates only packages that are in installation scope,
  and it also sets installation scope to be the default, so that's why
  `make` tends to update everything that is installed. Maybe Sam should
  install additional packages in user scope, and then `make` won't try to
  update them.
 
 I expect that the packages that update for Matthias on `make` are
 packages in main-distribution

Ah, no. I've helped Matthias when problems break his installation, I've
noticed that he installs packages not in main-distribution (e.g.,
marketplace), and I believe he really does want those updated.

I had that context in mind but didn't think to spell it out as I should
have.


 As an aside, the reason I don't install in user scope is that I switch
 between Racket implementations regularly, which would lead to
 out-of-date zo errors for all my user packages (instead, I get
 multiple copies of the packages).

You can give each installation a different name (using `raco pkg config
--set name ...`) to avoid the collision. That would be an extra step in
setting up each new installation, though.


I don't have a strong opinion on whether `make` should update packages
outside of main-distribution, but the feedback I'm getting is

 * Sam doesn't think they should be updated --- but he also doesn't
   want packages in main-distribution updated, so he's going to use
   `make as-is`.

 * Everyone else who has spoken up seems to prefer an updating `make`,
   so far.

-- 
You received this message because you are subscribed to the Google Groups 
Racket Developers group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-dev+unsubscr...@googlegroups.com.
To post to this group, send email to racket-...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-dev/20150218125203.667906501B8%40mail-svr1.cs.utah.edu.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-dev] make --clone installed pkgs

2015-02-18 Thread Sam Tobin-Hochstadt
That seems like a fair summary and since my preference is clearly the
minority one, I'm happy to stick with 'make as-is'. The new mode for
pulling updates will help, as well.

Sam

On Wed, Feb 18, 2015, 7:52 AM Matthew Flatt mfl...@cs.utah.edu wrote:

 At Tue, 17 Feb 2015 19:59:38 -0500, Sam Tobin-Hochstadt wrote:
  On Tue, Feb 17, 2015 at 6:41 PM, Matthew Flatt mfl...@cs.utah.edu
 wrote:
   At Tue, 17 Feb 2015 14:12:54 -0500, Sam Tobin-Hochstadt wrote:
   Does another system have a Racket-like in-place option (that works
   better)?
 
  I haven't used it, but GHC has an in-place build option where you can
  install packages; see [1].

 I don't have a lot of experience with GHC, but I have talked to some
 GHC and Cabal developers about how they work with the package system.
 Those discussions did not lead me to believe that they have an
 especially smooth system for working with packages and updates in-place
 --- and, in particular, that it's not the way they normally work. I'd
 be happy to hear more from someone who routinely works that way with
 GHC, though.

  I think the closer analogy is to what other software does when you run
  both `make` and `make install` analagous to Racket's unix-style
  installation, since that's the recommended way of building (eg
  Python), just as in-place is the recommended way of building Racket
  from source. I don't think any of those systems update packages when
  running `make install`.

 I'm not sure what you're getting at here. We seem to agree that the
 usual `make` plus `make install` is like Racket's `make unix-style`,
 neither of which updates packages (other than the ones the makefile
 knows about).


   At Tue, 17 Feb 2015 17:40:36 -0500, Matthias Felleisen wrote:
   Speaking as the user I am, I really like it that make updates
   my extra-pkgs.
  
   Package scope provides one a way to get these different behaviors. The
   current `make` updates only packages that are in installation scope,
   and it also sets installation scope to be the default, so that's why
   `make` tends to update everything that is installed. Maybe Sam should
   install additional packages in user scope, and then `make` won't try to
   update them.
 
  I expect that the packages that update for Matthias on `make` are
  packages in main-distribution

 Ah, no. I've helped Matthias when problems break his installation, I've
 noticed that he installs packages not in main-distribution (e.g.,
 marketplace), and I believe he really does want those updated.

 I had that context in mind but didn't think to spell it out as I should
 have.


  As an aside, the reason I don't install in user scope is that I switch
  between Racket implementations regularly, which would lead to
  out-of-date zo errors for all my user packages (instead, I get
  multiple copies of the packages).

 You can give each installation a different name (using `raco pkg config
 --set name ...`) to avoid the collision. That would be an extra step in
 setting up each new installation, though.


 I don't have a strong opinion on whether `make` should update packages
 outside of main-distribution, but the feedback I'm getting is

  * Sam doesn't think they should be updated --- but he also doesn't
want packages in main-distribution updated, so he's going to use
`make as-is`.

  * Everyone else who has spoken up seems to prefer an updating `make`,
so far.



-- 
You received this message because you are subscribed to the Google Groups 
Racket Developers group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-dev+unsubscr...@googlegroups.com.
To post to this group, send email to racket-...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-dev/CAK%3DHD%2BbRiPnX%3DuWH2x6UjQTzkEZn5nR-UNb-9Bka8wvZHBx-GA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-dev] make --clone installed pkgs

2015-02-17 Thread Sam Tobin-Hochstadt
On Tue, Feb 17, 2015 at 8:49 PM, Matthias Felleisen
matth...@ccs.neu.edu wrote:

 On Feb 17, 2015, at 7:59 PM, Sam Tobin-Hochstadt wrote:

 I expect that the packages that update for Matthias on `make` are
 packages in main-distribution,


 Personally, I have used the 'same' one-line command
 going back to csv through svn and now git (_update).

 When I write Speaking as the user I am .. I am
 thinking of people like me. Then again, you're
 probably saying that I am the bottom element of
 the lattice of make/update knowledge, so never mind
 what I write.

No, what I mean is that many (all?) of the packages you're thinking of
are ones, like 2htdp, that are part of main-distribution, and thus
you're in a different position than someone who develops packages that
are not part of the distribution.

I certainly don't think you're the bottom element in that lattice --
after all, you've written a shell script to automate your work.

Sam

-- 
You received this message because you are subscribed to the Google Groups 
Racket Developers group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-dev+unsubscr...@googlegroups.com.
To post to this group, send email to racket-...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-dev/CAK%3DHD%2BYwVcHtYc%2BKCOMU4bCsLCyzaFwyB-9E8uPzBV8%2BsJvqdg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-dev] Racket compiler in Racket

2015-02-17 Thread Leif Andersen
Hello,

I am working on porting the racket compiler to racket. But it still has a
bit to go and I have not yet ported the optimizer. So go right ahead.

Thank you.


~Leif Andersen

On Sun, Feb 15, 2015 at 1:36 PM, Gustavo Massaccesi gust...@oma.org.ar
wrote:

 There is project to rewrite the Racket compiler in Racket. I'd like to
 know if it has advanced. In particular, if it's still possible to make
 big changes to the C code or it's better to wait and keep the code
 almost frozen.

 I'm planning to do few refactoring an improvements in the optimizer
 functions that handle predicates (for example expr_implies_predicate
 and check_known2_pred). The changes are small enough to be implemented
 in a pair of days (if I find no surprises) but they are big enough to
 be painful to port if the code is already translated.

 Gustavo

 --
 You received this message because you are subscribed to the Google Groups
 Racket Developers group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to racket-dev+unsubscr...@googlegroups.com.
 To post to this group, send email to racket-...@googlegroups.com.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/racket-dev/CAPaha9MMSSNLL-30%2B5bUzKgMb8qERN-%3DEOikEV%2B8ySoHcdzSeQ%40mail.gmail.com
 .
 For more options, visit https://groups.google.com/d/optout.


-- 
You received this message because you are subscribed to the Google Groups 
Racket Developers group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-dev+unsubscr...@googlegroups.com.
To post to this group, send email to racket-...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-dev/CAAVaeEBhM-MtW5rZ%2B1Y0f40%2BY_JF3-VAUgLoTUE83v%3DtJYH_fA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-dev] What is the policy on what is included in the core libraries?

2015-02-17 Thread Jens Axel Søgaard
2015-02-17 14:26 GMT+01:00 Robby Findler ro...@eecs.northwestern.edu:
 I don't think the libraries are sufficient as is, but I would resist
 adding aliases.

A alternative: Added the word  zip  to the documentation index,
link it to map and have an example where in (map list ...) is used.

Also: Isn't zip in srfi/1 ?

/Jens Axel

-- 
You received this message because you are subscribed to the Google Groups 
Racket Developers group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-dev+unsubscr...@googlegroups.com.
To post to this group, send email to racket-...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-dev/CABefVgz2g3svHzxg55Y11DWi%3DAKqm21YRvu777owxi4p_tqNNg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-dev] What is the policy on what is included in the core libraries?

2015-02-17 Thread Eli Barzilay
On Tue, Feb 17, 2015 at 8:26 AM, Robby Findler
ro...@eecs.northwestern.edu wrote:
 I don't think the libraries are sufficient as is, but I would resist
 adding aliases.

 Perhaps a better way to get people coming from Haskell would be to
 write an essay specifically aimed there?

   - Step 1: use variables.
   - Step 2: here are `for` loops!

Instead of an essay, this could be a guide for Haskellers/MLers/
Whatever-ers, which would make it easy to get results into documentation
searches, and that would make it easy to address issues that cannot be
resolved with a new binding like the bad argument order in `take` or the
different input function for the folds.

(Another point for avoiding a `zip` binding is that it's much more
likely to collide with user defined functions than it is in other
languages.)

-- 
  ((lambda (x) (x x)) (lambda (x) (x x)))  Eli Barzilay:
http://barzilay.org/   Maze is Life!

-- 
You received this message because you are subscribed to the Google Groups 
Racket Developers group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-dev+unsubscr...@googlegroups.com.
To post to this group, send email to racket-...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-dev/CALO-gusXr5Di4GBb3-xi3R5sL8G1CcAfNs3%2BBOB-7uM_AavGvA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-dev] What is the policy on what is included in the core libraries?

2015-02-17 Thread Sam Tobin-Hochstadt
On Tue, Feb 17, 2015 at 11:31 AM, Jens Axel Søgaard
jensa...@soegaard.net wrote:
 2015-02-17 14:26 GMT+01:00 Robby Findler ro...@eecs.northwestern.edu:
 I don't think the libraries are sufficient as is, but I would resist
 adding aliases.

 A alternative: Added the word  zip  to the documentation index,
 link it to map and have an example where in (map list ...) is used.

Since `zip` isn't an alias for anything, I think we should add it.

Sam

-- 
You received this message because you are subscribed to the Google Groups 
Racket Developers group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-dev+unsubscr...@googlegroups.com.
To post to this group, send email to racket-...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-dev/CAK%3DHD%2BYOu17C96DO0q7HRw5yAQEK0aXurewX%3DeDYEMmHpAz%2BBg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-dev] What is the policy on what is included in the core libraries?

2015-02-17 Thread Vincent St-Amour
I don't think we should add functions to TR that are not in Racket and
that are not clearly type-related (e.g., `cast`).

I also like Jens's solution better. Education vs crutches.

Vincent



At Tue, 17 Feb 2015 10:39:16 -0500,
Matthias Felleisen wrote:
 
 
 I'd add them to Typed Racket. That's what Haskellians are most likely to 
 explore and when they find them, it's a good thing (tm). -- Matthias
 
 
 
 
 On Feb 17, 2015, at 2:18 AM, Alexis King lexi.lam...@gmail.com wrote:
 
  I was just thinking today that I would, for example, find it useful to have 
  a (zip ...) function in racket/list that would be equivalent to (map list 
  ...). Users coming from a Haskell background might even find it useful to 
  have a zip-with function that is simply an alias for map. Admittedly, these 
  are rather trivial, but (especially in the first case) I think they’d still 
  be useful.
  
  I am all for avoiding feature creep and code bloat, but Racket’s “batteries 
  included” approach seems to make functions like these prime candidates for 
  libraries like racket/list. As long as they’re not in racket/base, they 
  seem fairly harmless, especially considering they would only be needed at 
  compile-time.
  
  Should I even consider adding things like this, or is the consensus that 
  the libraries are mostly sufficient as-is?
  
  -- 
  You received this message because you are subscribed to the Google Groups 
  Racket Developers group.
  To unsubscribe from this group and stop receiving emails from it, send an 
  email to racket-dev+unsubscr...@googlegroups.com.
  To post to this group, send email to racket-...@googlegroups.com.
  To view this discussion on the web visit 
  https://groups.google.com/d/msgid/racket-dev/5D941DB1-8A55-4A41-98A2-A3BE1BFE6D40%40gmail.com.
  For more options, visit https://groups.google.com/d/optout.
 
 -- 
 You received this message because you are subscribed to the Google Groups 
 Racket Developers group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to racket-dev+unsubscr...@googlegroups.com.
 To post to this group, send email to racket-...@googlegroups.com.
 To view this discussion on the web visit 
 https://groups.google.com/d/msgid/racket-dev/EAAD5B93-DB78-419B-A662-131AD1D3E303%40ccs.neu.edu.
 For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
Racket Developers group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-dev+unsubscr...@googlegroups.com.
To post to this group, send email to racket-...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-dev/87d258qxg8.wl%25stamourv%40ccs.neu.edu.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-dev] What is the policy on what is included in the core libraries?

2015-02-17 Thread Matthias Felleisen

At some point TR will move on, and perhaps the time has come. 


On Feb 17, 2015, at 12:06 PM, Vincent St-Amour stamo...@ccs.neu.edu wrote:

 I don't think we should add functions to TR that are not in Racket and
 that are not clearly type-related (e.g., `cast`).
 
 I also like Jens's solution better. Education vs crutches.
 
 Vincent
 
 
 
 At Tue, 17 Feb 2015 10:39:16 -0500,
 Matthias Felleisen wrote:
 
 
 I'd add them to Typed Racket. That's what Haskellians are most likely to 
 explore and when they find them, it's a good thing (tm). -- Matthias
 
 
 
 
 On Feb 17, 2015, at 2:18 AM, Alexis King lexi.lam...@gmail.com wrote:
 
 I was just thinking today that I would, for example, find it useful to have 
 a (zip ...) function in racket/list that would be equivalent to (map list 
 ...). Users coming from a Haskell background might even find it useful to 
 have a zip-with function that is simply an alias for map. Admittedly, these 
 are rather trivial, but (especially in the first case) I think they’d still 
 be useful.
 
 I am all for avoiding feature creep and code bloat, but Racket’s “batteries 
 included” approach seems to make functions like these prime candidates for 
 libraries like racket/list. As long as they’re not in racket/base, they 
 seem fairly harmless, especially considering they would only be needed at 
 compile-time.
 
 Should I even consider adding things like this, or is the consensus that 
 the libraries are mostly sufficient as-is?
 
 -- 
 You received this message because you are subscribed to the Google Groups 
 Racket Developers group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to racket-dev+unsubscr...@googlegroups.com.
 To post to this group, send email to racket-...@googlegroups.com.
 To view this discussion on the web visit 
 https://groups.google.com/d/msgid/racket-dev/5D941DB1-8A55-4A41-98A2-A3BE1BFE6D40%40gmail.com.
 For more options, visit https://groups.google.com/d/optout.
 
 -- 
 You received this message because you are subscribed to the Google Groups 
 Racket Developers group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to racket-dev+unsubscr...@googlegroups.com.
 To post to this group, send email to racket-...@googlegroups.com.
 To view this discussion on the web visit 
 https://groups.google.com/d/msgid/racket-dev/EAAD5B93-DB78-419B-A662-131AD1D3E303%40ccs.neu.edu.
 For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
Racket Developers group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-dev+unsubscr...@googlegroups.com.
To post to this group, send email to racket-...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-dev/63C7696A-1532-400A-825D-247BB3E31750%40ccs.neu.edu.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-dev] make --clone installed pkgs

2015-02-17 Thread Sam Tobin-Hochstadt
I think there are two seperable issues here:

1. Can we make `raco pkg update -a` better/more robust in this case?

2. Should `make` run `raco pkg update -a`?

In reverse order:

- I think `make`, by default, shouldn't update anything, and that we
should have a different Makefile target which updates things when
people want that explicitly. The current behavior is especially
problematic because it updates things that aren't in
main-distribution, meaning that it's making potentially arbitrary
breaking changes to software on your computer (not just to core
Racket).

This could be more inconvenient for someone working widely on core
packages, but if they wanted the current behavior it would be just
`make update` (or some other name) instead of `make`. As someone who
does work on a lot of core packages, I'd prefer greater explicitness.

- I think `raco pkg update p` where `p` is a cloned package should
only do anything if (a) the currently-checked-out branch is the one in
the pkg source and (b) the `git merge --ff-only` command would
succeed. Otherwise, I think it should just print a message and leave
the repository as it is. I think that's what I wanted all the times
that this operation has failed in my experience.

Sam

On Tue, Feb 17, 2015 at 9:54 AM, Robby Findler
ro...@eecs.northwestern.edu wrote:
 Sam and I have run into a situation where `make` fails because we've
 set up clone pkgs and made local modifications in a way that makes the
 git commands fail [*].

 My guess is that the right thing to do is for me to know about these
 pkgs and do something special when running make. I'm thinking that I
 could let make finish the initial steps until it gets to the step
 where it updates the pkgs and then do the update step myself and then
 run `make as-is`. But the problem with this is that I don't see what
 command I can run that will update all of the pkgs except the
 problematic ones. Like I could imagine a `raco pkg update
 --all-except-clones` or something, but that feels a bit strange as
 there could be other development modes that would also run into
 similar problems. Maybe `raco pkg update
 --all-things-from-this-catalog
 the-catalog-I-currently-get-main-distribution-from` or something
 along those lines is the way to go? In general, it seems right for me
 to run some commands whose complications are roughly proportional to
 the number of pkgs that I have installed as clones (and where I'm
 actively developing them) but not to run some commands that require me
 to do something special for each pkg that is installed.

 Any ideas? Or am I just missing the right command?

 Thanks,
 Robby

 [*] In my case, in case this suggests a better/different approach to a
 resolution: the `raco pkg update` step eventually gets to this git
 command:

   git merge --ff-only sha1

 where the sha1 is the checksum from the pkg server, I believe. In my
 case, this is a different branch than is currently checked in my
 clone'd pkg and so the git merge command fails (and that command
 failing seems like the right behavior for the setup I'd like to be
 able to use).

 --
 You received this message because you are subscribed to the Google Groups 
 Racket Developers group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to racket-dev+unsubscr...@googlegroups.com.
 To post to this group, send email to racket-...@googlegroups.com.
 To view this discussion on the web visit 
 https://groups.google.com/d/msgid/racket-dev/CAL3TdONOjL3_y8U_A1ZUoz_1Z%3DE3HjVV8by9e%2B2dS-W2mc51pg%40mail.gmail.com.
 For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
Racket Developers group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-dev+unsubscr...@googlegroups.com.
To post to this group, send email to racket-...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-dev/CAK%3DHD%2BbYrWHAxWssmvXFA%2BA0tco2RDAXwORQj_iwOq%3DpYXzZOA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-dev] What is the policy on what is included in the core libraries?

2015-02-17 Thread Matthias Felleisen

I'd add them to Typed Racket. That's what Haskellians are most likely to 
explore and when they find them, it's a good thing (tm). -- Matthias




On Feb 17, 2015, at 2:18 AM, Alexis King lexi.lam...@gmail.com wrote:

 I was just thinking today that I would, for example, find it useful to have a 
 (zip ...) function in racket/list that would be equivalent to (map list ...). 
 Users coming from a Haskell background might even find it useful to have a 
 zip-with function that is simply an alias for map. Admittedly, these are 
 rather trivial, but (especially in the first case) I think they’d still be 
 useful.
 
 I am all for avoiding feature creep and code bloat, but Racket’s “batteries 
 included” approach seems to make functions like these prime candidates for 
 libraries like racket/list. As long as they’re not in racket/base, they seem 
 fairly harmless, especially considering they would only be needed at 
 compile-time.
 
 Should I even consider adding things like this, or is the consensus that the 
 libraries are mostly sufficient as-is?
 
 -- 
 You received this message because you are subscribed to the Google Groups 
 Racket Developers group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to racket-dev+unsubscr...@googlegroups.com.
 To post to this group, send email to racket-...@googlegroups.com.
 To view this discussion on the web visit 
 https://groups.google.com/d/msgid/racket-dev/5D941DB1-8A55-4A41-98A2-A3BE1BFE6D40%40gmail.com.
 For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
Racket Developers group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-dev+unsubscr...@googlegroups.com.
To post to this group, send email to racket-...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-dev/EAAD5B93-DB78-419B-A662-131AD1D3E303%40ccs.neu.edu.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-dev] What is the policy on what is included in the core libraries?

2015-02-17 Thread Robby Findler
I don't think the libraries are sufficient as is, but I would resist
adding aliases.

Perhaps a better way to get people coming from Haskell would be to
write an essay specifically aimed there?

  - Step 1: use variables.
  - Step 2: here are `for` loops!

;)

Robby


On Tue, Feb 17, 2015 at 1:18 AM, Alexis King lexi.lam...@gmail.com wrote:
 I was just thinking today that I would, for example, find it useful to have
 a (zip ...) function in racket/list that would be equivalent to (map list
 ...). Users coming from a Haskell background might even find it useful to
 have a zip-with function that is simply an alias for map. Admittedly, these
 are rather trivial, but (especially in the first case) I think they’d still
 be useful.

 I am all for avoiding feature creep and code bloat, but Racket’s “batteries
 included” approach seems to make functions like these prime candidates for
 libraries like racket/list. As long as they’re not in racket/base, they seem
 fairly harmless, especially considering they would only be needed at
 compile-time.

 Should I even consider adding things like this, or is the consensus that the
 libraries are mostly sufficient as-is?

 --
 You received this message because you are subscribed to the Google Groups
 Racket Developers group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to racket-dev+unsubscr...@googlegroups.com.
 To post to this group, send email to racket-...@googlegroups.com.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/racket-dev/5D941DB1-8A55-4A41-98A2-A3BE1BFE6D40%40gmail.com.
 For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
Racket Developers group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-dev+unsubscr...@googlegroups.com.
To post to this group, send email to racket-...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-dev/CAL3TdONpdpZX%3D63ZtmPxTytPfw_PrL6gR6dwQXcbnS5_cB2OcQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-dev] What is the policy on what is included in the core libraries?

2015-02-17 Thread Robby Findler
Yes, that's true.

Robby

On Tue, Feb 17, 2015 at 10:50 AM, Sam Tobin-Hochstadt
sa...@cs.indiana.edu wrote:
 On Tue, Feb 17, 2015 at 11:31 AM, Jens Axel Søgaard
 jensa...@soegaard.net wrote:
 2015-02-17 14:26 GMT+01:00 Robby Findler ro...@eecs.northwestern.edu:
 I don't think the libraries are sufficient as is, but I would resist
 adding aliases.

 A alternative: Added the word  zip  to the documentation index,
 link it to map and have an example where in (map list ...) is used.

 Since `zip` isn't an alias for anything, I think we should add it.

 Sam

-- 
You received this message because you are subscribed to the Google Groups 
Racket Developers group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-dev+unsubscr...@googlegroups.com.
To post to this group, send email to racket-...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-dev/CAL3TdONe3-xhiVrpQ%3D8ZGc9AjYr9NBoxCj5JDVDdr0trckKPpw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-dev] file change notifications

2015-02-03 Thread Dan Liebgold
Ah, I wanted to reply to my original email. I was wrong.

There's a cancel event that lasts a long time according to Procmon, but it
seems to last as long as the racket executable is running. I don't think
 it's the source of any performance problem.

So, yeah... carry on, nothing to see here.

Thanks,
Dan


On Mon, Feb 2, 2015 at 11:26 PM, Matthew Flatt mfl...@cs.utah.edu wrote:

 It's good to know that canceling a filesystem-change event can be
 expensive on Windows, in which case they probably shouldn't be used on
 Windows when resolving module paths. I'll investigate more and remove
 the use.

 Meanwhile, there's not a good way to disable the current use in v6.1,
 but the hack

   (unsafe-vector-set! (system-type 'fs-change) 2 #f)

 should work to disable it.


 At Mon, 2 Feb 2015 12:14:12 -0800, Dan Liebgold wrote:
  Hi -
 
  I'm doing a little profiling of Racket 6.1 on windows. It seems like
  cancelling a filesystem-change-evt can take many seconds, and one is
  cancelled for the addon-dir directory (which defaults to my roaming
  profile) during every run. I think it interacts badly with my virus
 checker.
 
  Is there a way to disable this? I'm not using the addon-dir, so any
  notifications shouldn't be important.
 
  Thanks,
  --
  Dan Liebgold[dan.liebg...@gmail.com]
  _
Racket Developers list:
http://lists.racket-lang.org/dev




-- 
Dan Liebgold[dan.liebg...@gmail.com]
_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] Github repo is two commits behind

2015-02-02 Thread Vincent St-Amour
FWIW, pulling from git.racket-lang.org has been slow (i.e. ~30mins) for
some of us in the last couple of days. Something in the mirroring may be
timing out for similar reasons.

Vincent



At Mon, 2 Feb 2015 18:41:56 -0300,
Gustavo Massaccesi wrote:
 
 * openssl: recognize version 1.0.1j #8265c9 (3 days ago) -- latest
 commit in git.racket-lang
 
 * pretty-print: fix for a current inspector that sees through
 internals #8d49a9 (3 days ago)
 
 * fix reified-syntax-class-curry (missing role argument) #302986 (3
 days ago) -- Latest commit in github
 
 Gustavo
 _
   Racket Developers list:
   http://lists.racket-lang.org/dev
_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] Github repo is two commits behind

2015-02-02 Thread Vincent St-Amour
I just pushed something, and now the Github mirror is up to date. The
push must have kicked the mirroring mechanism.

Vincent


At Mon, 02 Feb 2015 16:54:10 -0500,
Vincent St-Amour wrote:
 
 FWIW, pulling from git.racket-lang.org has been slow (i.e. ~30mins) for
 some of us in the last couple of days. Something in the mirroring may be
 timing out for similar reasons.
 
 Vincent
 
 
 
 At Mon, 2 Feb 2015 18:41:56 -0300,
 Gustavo Massaccesi wrote:
  
  * openssl: recognize version 1.0.1j #8265c9 (3 days ago) -- latest
  commit in git.racket-lang
  
  * pretty-print: fix for a current inspector that sees through
  internals #8d49a9 (3 days ago)
  
  * fix reified-syntax-class-curry (missing role argument) #302986 (3
  days ago) -- Latest commit in github
  
  Gustavo
  _
Racket Developers list:
http://lists.racket-lang.org/dev
_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] file change notifications

2015-02-02 Thread Matthew Flatt
It's good to know that canceling a filesystem-change event can be
expensive on Windows, in which case they probably shouldn't be used on
Windows when resolving module paths. I'll investigate more and remove
the use.

Meanwhile, there's not a good way to disable the current use in v6.1,
but the hack

  (unsafe-vector-set! (system-type 'fs-change) 2 #f)

should work to disable it.


At Mon, 2 Feb 2015 12:14:12 -0800, Dan Liebgold wrote:
 Hi -
 
 I'm doing a little profiling of Racket 6.1 on windows. It seems like
 cancelling a filesystem-change-evt can take many seconds, and one is
 cancelled for the addon-dir directory (which defaults to my roaming
 profile) during every run. I think it interacts badly with my virus checker.
 
 Is there a way to disable this? I'm not using the addon-dir, so any
 notifications shouldn't be important.
 
 Thanks,
 -- 
 Dan Liebgold[dan.liebg...@gmail.com]
 _
   Racket Developers list:
   http://lists.racket-lang.org/dev
_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] [plt] Push #29677: master branch updated

2015-01-31 Thread Matthew Flatt
I noticed when I made that change that the .dep format is still not
documented anywhere. I'll document it soon.

Here's a first cut at the grammar of the value that is stored in a
.dep file via `write`:

 deps = (list version-string
(cons hash-of-source hash-of-dependencies)
dep ...)
 dep = (cons 'indirect direct-dep)
   | direct-dep
 direct-dep = (cons 'ext plain-dep) ; non-module dependency
  | plain-dep ; module dependency
 plain-dep = (cons 'collects byte-string) ; a collection-relative path
 | byte-string  ; other path (not portable)
   

At Fri, 30 Jan 2015 22:29:11 -0800, Eric Dobson wrote:
 This change seemed to change the format of .dep files, likely as intended
 to add the indirect dependencies. Is there any documentation of what the
 format is supposed to be? Currently I've just been trying to read cm.rkt
 and understand how it treats them.
 
 On Thu, Jan 8, 2015 at 9:31 AM, mfl...@racket-lang.org wrote:
 
  mflatt has updated `master' from c56c9250f1 to 95e85ec5bd.
http://git.racket-lang.org/plt/c56c9250f1..95e85ec5bd
 
  =[ 2 Commits ]==
  Directory summary:
45.1% pkgs/racket-doc/scribblings/raco/
 4.7% pkgs/racket-doc/scribblings/reference/
47.5% racket/collects/compiler/
 
  ~~
 
  fe9a04d Matthew Flatt mfl...@racket-lang.org 2015-01-08 09:11
  :
  | doc tweaks for `raco {setup,make}`
  :
M pkgs/racket-doc/scribblings/raco/make.scrbl  |  4 ++--
M pkgs/racket-doc/scribblings/raco/setup.scrbl | 22
  --
 
  ~~
 
  95e85ec Matthew Flatt mfl...@racket-lang.org 2015-01-08 09:57
  :
  | add support for indirect CM dependencies; use in `lazy-require`
  |
  | If module M in package P imports module N from package Q,
  | and if N has a `lazy-require` for a module in R that is
  | triggered during the compilation of M, then P doesn't really
  | depend on R; P depends on Q, and Q depends on R, and P
  | shoudn't necessarily know anything about Q. At the same time,
  | a change to the file in R means that M must be recompiled.
  | So, continue to track the compilation dependency, but mark
  | it as indirect so that the package-dependency checker can
  | ignore the dependency.
  :
M pkgs/racket-doc/scribblings/raco/make.scrbl   | 33 -
M racket/collects/compiler/cm-accomplice.rkt| 14 +++---
M racket/collects/compiler/cm.rkt   | 49
  ++--
M racket/collects/racket/lazy-require.rkt   |  2 +-
M racket/collects/setup/private/pkg-deps.rkt|  1 +
M .../racket-doc/scribblings/reference/syntax.scrbl |  8 ++--
 
  =[ Overall Diff ]===
 
  pkgs/racket-doc/scribblings/raco/make.scrbl
  ~~~
  --- OLD/pkgs/racket-doc/scribblings/raco/make.scrbl
  +++ NEW/pkgs/racket-doc/scribblings/raco/make.scrbl
  @@ -123,7 +123,7 @@ would create only @filepath{compiled/b_rkt.zo} and
 
   @; --
 
  -@section{Dependency Files}
  +@section[#:tag Dependency Files]{Dependency Files}
 
   In addition to a bytecode file, @exec{raco make} creates a file
   @filepath{compiled/@nonterm{name}_@nonterm{ext}.dep} that records
  @@ -538,7 +538,7 @@ messages are instances of a
  @racket[parallel-compile-event] prefab structure:
 
   @racketblock[
 (struct parallel-compile-event (worker event) #:prefab)
  -].
  +]
 
   The worker field is the index of the worker that the created the event.
  The event
   field is a @racket[compile-event] as document in
  @@ -550,25 +550,36 @@ field is a @racket[compile-event] as document in
 
   @defmodule[compiler/cm-accomplice]
 
  -@defproc[(register-external-file [file (and path? complete-path?)])
  void?]{
  +@defproc[(register-external-file [file (and path? complete-path?)]
  + [#:indirect? indirect? any/c #f])
  + void?]{
 
  -Logs a message (see @racket[log-message]) at level @racket['info] to
  -a logger named @racket['cm-accomplice]. The
  -message data is a @racketidfont{file-dependency} prefab structure type
  -with two fields; the first field's value is @racket[file] and the second
  -field's value is @racket[#f] (to indicate a non-module dependency).
  +Logs a message (see @racket[log-message]) at level @racket['info] to a
  +logger named @racket['cm-accomplice]. The message data is a
  +@racketidfont{file-dependency} prefab structure type with two fields;
  +the first field's value is @racket[file] and the second field's value
  +is @racket[#f] (to indicate a non-module dependency). If the
  +@racket[indirect?] argument is true, the data is more specifically an
  +instance of a @racketidfont{file-dependency/indirect} prefab structure
  +type that is a subtype of @racketidfont{file-dependency} with no new
  

Re: [racket-dev] Switching to Google Groups

2015-01-31 Thread Juan Francisco Cantero Hurtado
Please contact with gmane to update the info about the lists. I use its 
service to access to the list with NNTP.



On 01/29/2015 01:47 AM, John Clements wrote:

Dear developers,

PLT would like to get out of the mailing-list administration game.

Accordingly, we’re planning to switch to Google Groups. Rather than
starting with our largest list, the Racket Users list, we’ve chosen to
begin with the dev list, because … well, you’re probably more tolerant,
if^H^H when something goes wrong.

We would like the transition to be as smooth as possible, and we can use
your help with this.  Specifically, Google has a daily cap on the number of
e-mail addresses that can be bulk-added to a mailing list. For this reason,
it would speed the transition greatly if you could take a moment to sign up
for the new group yourself, using this URL:

https://groups.google.com/forum/#!forum/racket-dev

We plan to disable signup for the old group now, and to halt delivery of
mail to the existing group address tomorrow. You can post to the new group
(after signing up) by sending mail to

racket-...@googlegroups.com

We plan to manually add or invite the members who do not add themselves,
but the daily cap will mean that these users are likely to miss one or more
days of postings to this list. Naturally, those posts will be archived, as
part of the group.

The archive of the existing list will continue to exist, though new
messages will not be added to it.

Let us know if you run into problems!

Many thanks,

John Clements  PLT



_
   Racket Developers list:
   http://lists.racket-lang.org/dev




_
 Racket Developers list:
 http://lists.racket-lang.org/dev


Re: [racket-dev] A proposal for parametric opaque types in Typed Racket

2015-01-30 Thread Alexander D. Knauth

On Jan 30, 2015, at 3:59 PM, Alexis King lexi.lam...@gmail.com wrote:

 No, the typechecker can’t make any assumptions about the results of opaque 
 types. If you explicitly instantiate a Posn with the type Real, the 
 typechecker should only guarantee the result will be Real. Annotate the type 
 as (U 1 2), though, and obviously it would need to ensure that remains 
 invariant.

How about this program:
untyped.rkt:
#lang racket
(provide (all-defined-out))
(define (make-posn x y) (list 3 y)) ; bad
typed.rkt:
#lang typed/racket
; make Posn parametric
(define-type (Posn X Y) (List X Y))
(require/typed untyped.rkt
   [make-posn (All (X Y) X Y - (Posn X Y))])
(: p : (Posn Real Real))
(define p (make-posn 1 2))
This gives this error:
. . make-posn: broke its contract
  promised: X3
  produced: 3
  in: the car of
  the range of
  (parametric-/c
   (X3 Y4)
   (-*
(X3 Y4)
()
(values (cons/c X3 (cons/c Y4 g6)
  contract from: (interface for make-posn)
  blaming: (interface for make-posn)
   (assuming the contract is correct)
  at: …./typed.rkt:5.16

I think it’s a good thing that it checks that it actually gives you the value 
that you gave it, and not just something like 3 even if it happens to match the 
type you want.  And I think parametric opaque types should behave in a similar 
way, and to do that you would need the opaque value to be wrapped in another 
opaque structure, which would store either the contracts or the set of values 
that would pass the contracts or something like that.  

 
 On Jan 30, 2015, at 12:30, Alexander D. Knauth alexan...@knauth.org wrote:
 
 
 On Jan 30, 2015, at 1:53 PM, Alexis King lexi.lam...@gmail.com wrote:
 
 No, it doesn’t need to be wrapped in an opaque structure. Wrapping it in an 
 opaque structure would add a layer of indirection for absolutely no gain. 
 Remember, the value itself is already, by definition, opaque. The only way 
 typed code can manipulate the value is by passing it to other functions 
 imported via require/typed.
 
 This means that contracts only need to be generated wherever those 
 functions are called. This can be done without wrapping or unwrapping 
 anything because all the information required to generate those contracts 
 is known at expansion-time. The typechecker simply needs to insert the 
 relevant contracts at the relevant locations.
 
 Imagine a program like this:
 #lang typed/racket
 (require typed/lang/posn)
 (: p : (Posn Real Real)) ; I’m assuming Posn is parametric over 2 tvars, not 
 1
 (define p (posn 1 2))
 (: x : Real)
 (define x (posn-x p))
 As far as the type checker would check, it would check that the result of 
 posn-x is a Real, but I think that the runtime contract it should also check 
 that it returns 1, because posn could have been instantiated as (Posn 1 2).
 #lang typed/racket
 (require typed/lang/posn/mutable) ; like typed/lang/posn, but providing 
 mutation too
 (: p : (Posn Real Real))
 (define p (posn 1 2))
 (: x : Real)
 (define x (posn-x p))
 (set-posn-x! p 3)
 (: x2 : Real)
 (define x2 (posn-x p))
 Here, even though the type checker only cares that it’s a number, it should 
 check that x2 definition returns either 1 or 3, since both were provided as 
 x values for the posn p.
 
 For it to keep track of these at runtime, (and it would have to be runtime) 
 the contracts would have to be with the actual posn value in an opaque 
 structure, which would have contracts sort of like (new-∀/c) that would 
 check these things, although I don’t think it would have to wrap the inner 
 values, but just record them so that when posn-x is called on one of these 
 things, it checks that it was one of the values that was passed in to either 
 a constructor or setter function.  
 
 On Jan 30, 2015, at 07:27, Alexander D. Knauth alexan...@knauth.org 
 wrote:
  
 On Thu, Jan 29, 2015, at 09:03 PM, Alexis King wrote:
 It isn’t wrapped in an opaque structure. That wasn’t a part of my 
 proposal, and while I didn’t think of it until you brought it up, I still 
 think it’s unnecessary and doesn’t add any convenience.
  
 I think the opaque structures would be necessary for the kind of sharing 
 wrappers between functions that you describe just before section 2.1, 
 except that instead of the sub-values being wrapped on the untyped side, 
 the whole thing is wrapped on the typed side, and there is a contract that 
 wraps it and unwraps it when it goes from untyped to typed and back.  
  
 For parametric types, they have to also work if the type was constrained 
 to the exact set of values that were provided, which means that if you 
 provide two numbers, say 1 and 2, it has to return a posn with not just 
 any two numbers, but values of the type (U 1 2), since A could have been 
 constrained to (U 1 2).  So it has to be wrapped somehow, and I think 
 wrapping it on the typed side makes more sense.  
  
 Perhaps I’m not understanding you properly, but your “one-length string” 
 

Re: [racket-dev] A proposal for parametric opaque types in Typed Racket

2015-01-30 Thread Alexis King
No, it doesn’t need to be wrapped in an opaque structure. Wrapping it in an 
opaque structure would add a layer of indirection for absolutely no gain. 
Remember, the value itself is already, by definition, opaque. The only way 
typed code can manipulate the value is by passing it to other functions 
imported via require/typed.

This means that contracts only need to be generated wherever those functions 
are called. This can be done without wrapping or unwrapping anything because 
all the information required to generate those contracts is known at 
expansion-time. The typechecker simply needs to insert the relevant contracts 
at the relevant locations.

 On Jan 30, 2015, at 07:27, Alexander D. Knauth alexan...@knauth.org wrote:
 
  
  
  
 On Thu, Jan 29, 2015, at 09:03 PM, Alexis King wrote:
 It isn’t wrapped in an opaque structure. That wasn’t a part of my proposal, 
 and while I didn’t think of it until you brought it up, I still think it’s 
 unnecessary and doesn’t add any convenience.
  
 I think the opaque structures would be necessary for the kind of sharing 
 wrappers between functions that you describe just before section 2.1, except 
 that instead of the sub-values being wrapped on the untyped side, the whole 
 thing is wrapped on the typed side, and there is a contract that wraps it and 
 unwraps it when it goes from untyped to typed and back.  
  
 For parametric types, they have to also work if the type was constrained to 
 the exact set of values that were provided, which means that if you provide 
 two numbers, say 1 and 2, it has to return a posn with not just any two 
 numbers, but values of the type (U 1 2), since A could have been constrained 
 to (U 1 2).  So it has to be wrapped somehow, and I think wrapping it on the 
 typed side makes more sense.  
  
 Perhaps I’m not understanding you properly, but your “one-length string” 
 idea sounds like it has little to do with this opaque type problem and more 
 to do with the fact that you want refinement types in Typed Racket. I do, 
 too! But I don’t think hacking the opaque type system is going to help you 
 with that.
  
 Well, yeah, refinement types would be the real solution for this particular 
 example, but if I do want to constrain it to strings of length 1, opaque 
 types are the only option for now, and they actually work fine.  My point was 
 you couldn't do this type of thing with the opaque structures and you would 
 probably get weird errors if you tried.  (See below because there might be a 
 solution?)
  
 (Also, as for the box example, I’m actually a little surprised that doesn’t 
 contract error. Seems like a bug to me, but perhaps I’m missing some 
 idiosyncrasies of the type system. Either way, it’s precisely that kind of 
 craziness I was referring to when I compared casting parametric opaque types 
 to casting mutable types.)
  
 There is a bug report for it here, and the solution proposed by Sam 
 Tobin-Hochstadt would be for cast to generate 2 contracts, one for the 
 original type, one for the new type, but that never got implemented.  
 http://bugs.racket-lang.org/query/?cmd=viewpr=13626 
 http://bugs.racket-lang.org/query/?cmd=viewpr=13626
  
 Actually now that I think about it the two-contract solution might be able to 
 solve the previous problem, since the original contract could unwrap the 
 value before it is passed to the new contract?  I'm not sure though.  The 
 value inside the cast would be from the typed side, then it is passed through 
 the orig contract as if it were going to the typed side, which would unwrap 
 it, and then that unwrapped value would be passed to the new contract as if 
 it were flowing from the untyped side to the typed side.  
  
  
 On Jan 29, 2015, at 20:50, Alexander D. Knauth alexan...@knauth.org 
 mailto:alexan...@knauth.org wrote:
  
  
 On Jan 29, 2015, at 11:34 PM, Alexis King lexi.lam...@gmail.com 
 mailto:lexi.lam...@gmail.com wrote:
  
 But the problem is that if it’s an opaque type then it can’t unwrap it 
 once the value is returned from make-posn.
  
 Yes, that’s precisely the problem. Your point about implementing 
 everything as single-valued structs on the typed side is an interesting 
 one, though I don’t think it ultimately solves any problems. The fact that 
 the typed side knowsnothingabout the contents of the value is what makes 
 this such a tricky problem.
  
 As for this:
  
 But then you couldn’t do any operations on it except those that you use 
 import with require/typed, right?
  
 That’s completely correct. That’s why it’s “opaque.”
  
 And what happens if you use cast on one of these things?
  
 That’s a little more interesting. Usingcaston an object of this type would 
 never fail (unless, of course, it didn’t actually satisfy the 
 basicposn?predicate), but it would possibly introduce failures in the 
 future since it would affect the contracts generated forposn-xandposn-y, 
 for example.
  
 To make that more clear, casting a(Posn Real)to a(Posn 

Re: [racket-dev] A proposal for parametric opaque types in Typed Racket

2015-01-30 Thread Alexander D. Knauth

On Jan 30, 2015, at 1:53 PM, Alexis King lexi.lam...@gmail.com wrote:

 No, it doesn’t need to be wrapped in an opaque structure. Wrapping it in an 
 opaque structure would add a layer of indirection for absolutely no gain. 
 Remember, the value itself is already, by definition, opaque. The only way 
 typed code can manipulate the value is by passing it to other functions 
 imported via require/typed.
 
 This means that contracts only need to be generated wherever those functions 
 are called. This can be done without wrapping or unwrapping anything because 
 all the information required to generate those contracts is known at 
 expansion-time. The typechecker simply needs to insert the relevant contracts 
 at the relevant locations.

Imagine a program like this:
#lang typed/racket
(require typed/lang/posn)
(: p : (Posn Real Real)) ; I’m assuming Posn is parametric over 2 tvars, not 1
(define p (posn 1 2))
(: x : Real)
(define x (posn-x p))
As far as the type checker would check, it would check that the result of 
posn-x is a Real, but I think that the runtime contract it should also check 
that it returns 1, because posn could have been instantiated as (Posn 1 2).
#lang typed/racket
(require typed/lang/posn/mutable) ; like typed/lang/posn, but providing 
mutation too
(: p : (Posn Real Real))
(define p (posn 1 2))
(: x : Real)
(define x (posn-x p))
(set-posn-x! p 3)
(: x2 : Real)
(define x2 (posn-x p))
Here, even though the type checker only cares that it’s a number, it should 
check that x2 definition returns either 1 or 3, since both were provided as x 
values for the posn p.

For it to keep track of these at runtime, (and it would have to be runtime) the 
contracts would have to be with the actual posn value in an opaque structure, 
which would have contracts sort of like (new-∀/c) that would check these 
things, although I don’t think it would have to wrap the inner values, but just 
record them so that when posn-x is called on one of these things, it checks 
that it was one of the values that was passed in to either a constructor or 
setter function.  

 On Jan 30, 2015, at 07:27, Alexander D. Knauth alexan...@knauth.org wrote:
  
 On Thu, Jan 29, 2015, at 09:03 PM, Alexis King wrote:
 It isn’t wrapped in an opaque structure. That wasn’t a part of my proposal, 
 and while I didn’t think of it until you brought it up, I still think it’s 
 unnecessary and doesn’t add any convenience.
  
 I think the opaque structures would be necessary for the kind of sharing 
 wrappers between functions that you describe just before section 2.1, 
 except that instead of the sub-values being wrapped on the untyped side, the 
 whole thing is wrapped on the typed side, and there is a contract that wraps 
 it and unwraps it when it goes from untyped to typed and back.  
  
 For parametric types, they have to also work if the type was constrained to 
 the exact set of values that were provided, which means that if you provide 
 two numbers, say 1 and 2, it has to return a posn with not just any two 
 numbers, but values of the type (U 1 2), since A could have been constrained 
 to (U 1 2).  So it has to be wrapped somehow, and I think wrapping it on the 
 typed side makes more sense.  
  
 Perhaps I’m not understanding you properly, but your “one-length string” 
 idea sounds like it has little to do with this opaque type problem and more 
 to do with the fact that you want refinement types in Typed Racket. I do, 
 too! But I don’t think hacking the opaque type system is going to help you 
 with that.
  
 Well, yeah, refinement types would be the real solution for this 
 particular example, but if I do want to constrain it to strings of length 1, 
 opaque types are the only option for now, and they actually work fine.  My 
 point was you couldn't do this type of thing with the opaque structures and 
 you would probably get weird errors if you tried.  (See below because there 
 might be a solution?)
  
 (Also, as for the box example, I’m actually a little surprised that doesn’t 
 contract error. Seems like a bug to me, but perhaps I’m missing some 
 idiosyncrasies of the type system. Either way, it’s precisely that kind of 
 craziness I was referring to when I compared casting parametric opaque 
 types to casting mutable types.)
  
 There is a bug report for it here, and the solution proposed by Sam 
 Tobin-Hochstadt would be for cast to generate 2 contracts, one for the 
 original type, one for the new type, but that never got implemented.  
 http://bugs.racket-lang.org/query/?cmd=viewpr=13626
  
 Actually now that I think about it the two-contract solution might be able 
 to solve the previous problem, since the original contract could unwrap the 
 value before it is passed to the new contract?  I'm not sure though.  The 
 value inside the cast would be from the typed side, then it is passed 
 through the orig contract as if it were going to the typed side,

This was a typo, I meant to say “as if it were going to the 

Re: [racket-dev] [plt] Push #29677: master branch updated

2015-01-30 Thread Eric Dobson
This change seemed to change the format of .dep files, likely as intended
to add the indirect dependencies. Is there any documentation of what the
format is supposed to be? Currently I've just been trying to read cm.rkt
and understand how it treats them.

On Thu, Jan 8, 2015 at 9:31 AM, mfl...@racket-lang.org wrote:

 mflatt has updated `master' from c56c9250f1 to 95e85ec5bd.
   http://git.racket-lang.org/plt/c56c9250f1..95e85ec5bd

 =[ 2 Commits ]==
 Directory summary:
   45.1% pkgs/racket-doc/scribblings/raco/
4.7% pkgs/racket-doc/scribblings/reference/
   47.5% racket/collects/compiler/

 ~~

 fe9a04d Matthew Flatt mfl...@racket-lang.org 2015-01-08 09:11
 :
 | doc tweaks for `raco {setup,make}`
 :
   M pkgs/racket-doc/scribblings/raco/make.scrbl  |  4 ++--
   M pkgs/racket-doc/scribblings/raco/setup.scrbl | 22
 --

 ~~

 95e85ec Matthew Flatt mfl...@racket-lang.org 2015-01-08 09:57
 :
 | add support for indirect CM dependencies; use in `lazy-require`
 |
 | If module M in package P imports module N from package Q,
 | and if N has a `lazy-require` for a module in R that is
 | triggered during the compilation of M, then P doesn't really
 | depend on R; P depends on Q, and Q depends on R, and P
 | shoudn't necessarily know anything about Q. At the same time,
 | a change to the file in R means that M must be recompiled.
 | So, continue to track the compilation dependency, but mark
 | it as indirect so that the package-dependency checker can
 | ignore the dependency.
 :
   M pkgs/racket-doc/scribblings/raco/make.scrbl   | 33 -
   M racket/collects/compiler/cm-accomplice.rkt| 14 +++---
   M racket/collects/compiler/cm.rkt   | 49
 ++--
   M racket/collects/racket/lazy-require.rkt   |  2 +-
   M racket/collects/setup/private/pkg-deps.rkt|  1 +
   M .../racket-doc/scribblings/reference/syntax.scrbl |  8 ++--

 =[ Overall Diff ]===

 pkgs/racket-doc/scribblings/raco/make.scrbl
 ~~~
 --- OLD/pkgs/racket-doc/scribblings/raco/make.scrbl
 +++ NEW/pkgs/racket-doc/scribblings/raco/make.scrbl
 @@ -123,7 +123,7 @@ would create only @filepath{compiled/b_rkt.zo} and

  @; --

 -@section{Dependency Files}
 +@section[#:tag Dependency Files]{Dependency Files}

  In addition to a bytecode file, @exec{raco make} creates a file
  @filepath{compiled/@nonterm{name}_@nonterm{ext}.dep} that records
 @@ -538,7 +538,7 @@ messages are instances of a
 @racket[parallel-compile-event] prefab structure:

  @racketblock[
(struct parallel-compile-event (worker event) #:prefab)
 -].
 +]

  The worker field is the index of the worker that the created the event.
 The event
  field is a @racket[compile-event] as document in
 @@ -550,25 +550,36 @@ field is a @racket[compile-event] as document in

  @defmodule[compiler/cm-accomplice]

 -@defproc[(register-external-file [file (and path? complete-path?)])
 void?]{
 +@defproc[(register-external-file [file (and path? complete-path?)]
 + [#:indirect? indirect? any/c #f])
 + void?]{

 -Logs a message (see @racket[log-message]) at level @racket['info] to
 -a logger named @racket['cm-accomplice]. The
 -message data is a @racketidfont{file-dependency} prefab structure type
 -with two fields; the first field's value is @racket[file] and the second
 -field's value is @racket[#f] (to indicate a non-module dependency).
 +Logs a message (see @racket[log-message]) at level @racket['info] to a
 +logger named @racket['cm-accomplice]. The message data is a
 +@racketidfont{file-dependency} prefab structure type with two fields;
 +the first field's value is @racket[file] and the second field's value
 +is @racket[#f] (to indicate a non-module dependency). If the
 +@racket[indirect?] argument is true, the data is more specifically an
 +instance of a @racketidfont{file-dependency/indirect} prefab structure
 +type that is a subtype of @racketidfont{file-dependency} with no new
 +fields.

  A compilation manager implemented by @racketmodname[compiler/cm] looks
 -for such messages to register an external dependency. The compilation
 -manager records (in a @filepath{.dep} file) the path as contributing
 -to the implementation of the module currently being
 +for such messages to register an external dependency. In response, the
 +compilation manager records (in a @filepath{.dep} file) the path as
 +contributing to the implementation of the module currently being
  compiled. Afterward, if the registered file is modified, the
 -compilation manager will know to recompile the module.
 +compilation manager will know to recompile the module. An ``indirect''
 +dependency has no effect on recompilation, but it can signal to other
 +tools, such as a package-dependency 

Re: [racket-dev] feature request: thread-safe memoize-evt

2015-01-30 Thread Jan Dvořák
Thanks for your time.

On Thu, 2015-01-29 at 12:55 -0700, Matthew Flatt wrote:
 Would the simpler `once-evt` work in your situation, or do you need the
 guarantee that only one wait of E happens at a time?

OK, my original goal is to implement a remote method call multiplexer.
The kind where you send a message with an identifier and the remote
party eventually replies with the same identifier or possibly with a
well-known one to indicate an out-of-bound notification.

So, I'd like to end up with (something-receive-evt something key) and
(something-call-evt something key request).

I can see two ways to do that;

 1.  Have a dispatch table with pending messages.
 2.  Broadcast all incoming messages to all waiters.

Dispatch table requires non-racy invalidation of pending requests to
prevent resource leaks.

Broadcasting messages requires construction of a thread-safe memoizing
event combinator (produces next-evt and a single result).

Also, I have a feeling that I could get close to (1) if I keep some
cleanup thread and utilize nack-guard-evt, but something tells me it
might be racy.

Best regards,
Jan Dvorak

_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] Full transparency (was: dev Digest, Vol 72, Issue 31)

2015-01-29 Thread Byron Davies
Super!  Thank you.


On Thu, Jan 29, 2015 at 7:51 AM, Matthew Flatt mfl...@cs.utah.edu wrote:

 At Wed, 28 Jan 2015 16:21:51 -0700, Byron Davies wrote:
  Your code, commented:
 
  (define orig-i (current-inspector))  ; saves the original inspector
  (define sub-i (make-inspector orig-i))  ;make a new inspector whose
 parent
  is the original inspector
 
  (current-inspector sub-i)  ;makes the new inspector the current inspector
  (struct a (x))  ; creates a structure using the new inspector as the
  default inspector
  (define v (a 1))  ; creates an instance of the new structure
  (current-inspector orig-i) ;reverts the inspector to the original (the
  parent of the new inspector)
 
  I see how this works, but I'm a little confused about why it works.  I
 see
  that the new inspector is a child of the old one, and I read in the
  reference chapter that access is determined not by the inspector in force
  at creation time, but by the parent of that inspector, i.e., the old
  inspector. I can't find any description of the power of an inspector,
  except that the parent is more powerful.
 
  Are there degrees of power? Or if you have access to the parent do you
 have
  all the power you can have?

 There are degrees only in that you can have a hierarchy of inspectors.
 Inspector I is more powerful than inspector J if I is an ancestor of J.

 I'll try to improve the docs, such as replacing more powerful than
 with an ancestor of.

  I see that the inspector gives you access to
  the data in a structure instance, but does it also give you access to
  meta-data, so that I know that the name of the first field in struct a
 is x?

 You get access to all the metadata.

 It turns out that fields currently have only positions, not names, but
 that choice was not a good one. We plan to add support for field names
 in the near future, in which case the information will be accessible
 through an inspector.

  I also don't understand how the root inspector works.  I have found that
  setting (current-inspector root-inspector) delivers endless left parens
 for
  the (a 1) example, presumably because the display function recursively
  tries to inspect the components of the struct, all the way down.

 That's a problem in the pretty printer. The pretty printer's
 implementation includes

  (cond

[(struct? v) ]

[(unquoted? v) ]
)

 where `unquoted` is an internal structure. By setting the inspector to
 the root inspector, a value that satisfies `unquoted?` also satisfies
 `struct?`, and so printing doesn't reach the intended case. I'll push a
 repair.


  Finally, does this also work for classes?

 Yes. Reflective access to information via `object-info` and
 `class-info` is controlled by inspectors.


_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] Full transparency (was: dev Digest, Vol 72, Issue 31)

2015-01-29 Thread Matthew Flatt
At Wed, 28 Jan 2015 16:21:51 -0700, Byron Davies wrote:
 Your code, commented:
 
 (define orig-i (current-inspector))  ; saves the original inspector
 (define sub-i (make-inspector orig-i))  ;make a new inspector whose parent
 is the original inspector
 
 (current-inspector sub-i)  ;makes the new inspector the current inspector
 (struct a (x))  ; creates a structure using the new inspector as the
 default inspector
 (define v (a 1))  ; creates an instance of the new structure
 (current-inspector orig-i) ;reverts the inspector to the original (the
 parent of the new inspector)
 
 I see how this works, but I'm a little confused about why it works.  I see
 that the new inspector is a child of the old one, and I read in the
 reference chapter that access is determined not by the inspector in force
 at creation time, but by the parent of that inspector, i.e., the old
 inspector. I can't find any description of the power of an inspector,
 except that the parent is more powerful.

 Are there degrees of power? Or if you have access to the parent do you have
 all the power you can have? 

There are degrees only in that you can have a hierarchy of inspectors.
Inspector I is more powerful than inspector J if I is an ancestor of J.

I'll try to improve the docs, such as replacing more powerful than
with an ancestor of.

 I see that the inspector gives you access to
 the data in a structure instance, but does it also give you access to
 meta-data, so that I know that the name of the first field in struct a is x?

You get access to all the metadata.

It turns out that fields currently have only positions, not names, but
that choice was not a good one. We plan to add support for field names
in the near future, in which case the information will be accessible
through an inspector.

 I also don't understand how the root inspector works.  I have found that
 setting (current-inspector root-inspector) delivers endless left parens for
 the (a 1) example, presumably because the display function recursively
 tries to inspect the components of the struct, all the way down.

That's a problem in the pretty printer. The pretty printer's
implementation includes

 (cond
   
   [(struct? v) ]
   
   [(unquoted? v) ]
   )

where `unquoted` is an internal structure. By setting the inspector to
the root inspector, a value that satisfies `unquoted?` also satisfies
`struct?`, and so printing doesn't reach the intended case. I'll push a
repair.


 Finally, does this also work for classes?

Yes. Reflective access to information via `object-info` and
`class-info` is controlled by inspectors.

_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] build memory use (was: internal error during gc)

2015-01-29 Thread Matthew Flatt
At Thu, 29 Jan 2015 15:34:37 -0300, Gustavo Massaccesi wrote:
 If there are some easy technical details and advice, you can write a
 nice blog post about this.

Good idea. I have some advice on finalization (don't do it), and I
could write about how Racket tries to help when you can't follow that
advice.

 At line 109:
 +  (define max-val (apply max (map car measurements)))
 +  (define max-time (caddr (last measurements)))
 If you make multiple png at the same time, all of them get the same
 Peak and Duration.

Thanks! I had fixed that in http://github.com/racket/plt-build-plot,
but I forgot to update the service that uploads plot.rkt to the web
site. It will be fixed after the next run.

_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] feature request: thread-safe memoize-evt

2015-01-29 Thread Matthew Flatt
Hi Jan,

Interesting problem!

I think I see what you mean: There's no way to combine the completion
of an event plus saving its value as an atomic operation, except by
putting the synchronization in its own thread. But if you put the
synchronization in its own thread, then there's no way to prevent that
thread's synchronization when a consumer synchronization (i.e., one
that is waiting for the thread's result) picks a different event than
the one represented by the thread.

It's easy to make a complete+save combination atomic if it's built into
the scheduler. So, I can easily imagine adding a simpler primitive,
`once-evt`. The event OE created by `(once-evt E)` could save the first
result produced by E, but not attempt to have only a single wait on E.
That is, if OE1 is synchronized in multiple threads, then it would be
like synchronizing E in multiple threads, but only the first result
from E will be saved.

Unfortunately, `once-evt` isn't enough to implement `memoize-evt`. The
troublesome case is then thread T1 is synchronizing on OE1, T1 gets
suspended, and T2 starts waiting on OE1. In that case, you'd like T2 to
take over the wait, even if it means restarting E. You can detect that
T1 is suspended and have T2 start waiting on E, but there's no way to
cancel the wait of E in T1.

Building `memoize-evt` into the core doesn't the avoid the need to, at
some level, cancel T1's wait on E. I'll keep thinking about it, but it
looks like that would require deep changes to the scheduler.

Would the simpler `once-evt` work in your situation, or do you need the
guarantee that only one wait of E happens at a time?

Matthew

At Wed, 28 Jan 2015 13:49:51 +0100, Jan Dvořák wrote:
 Hi,
 
 I would like to ask for another extension of the Racket's event handling
 system. A `memoize-evt` constructor with following semantics:
 
 Given a base event E_b, memoize-evt will produce a memoizing event E_m.
 Synchronizing on E_m from any number of threads will block until a
 single value is produced by E_b. This value is then stored inside the
 E_m. From that moment on, E_m will always be immediately ready for
 synchronization and produce the stored value in all waiting threads.
 
 The single-threaded implementation is a trivial guard-evt + replace-evt
 + (wrap-evt always-evt) combo, but for thread-safety a temporary thread
 would be needed to wait for the base event and the solution would have
 different semantics then rest of the event system.
 
 A lower-level approach would also be possible; create something along
 the lines of a dynamic-wind-evt that would, with some cleverness, allow
 for generic thread-safe events via locking. Or create a locked-wrap-evt
 constructor that will not be ready until it's handler finishes.
 
 Hoping that I am not being too bothersome,
 from Prague with thanks,
 Jan Dvorak


_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] feature request: thread-safe memoize-evt

2015-01-29 Thread Robby Findler
Is the issue that the E_b from Jan's original message might produce
multiple values and you are supposed to take the value that's
available only after something syncs on the E_m?

That is, I thought you could just create a separate thread that sync's
on E_b and then whenever you get a value from it, then the E_m would
just continue to produce that all the time. But I think you're saying
that wouldn't work?

I guess I'm not getting it. Thanks for more explanation.

Robby


On Thu, Jan 29, 2015 at 1:55 PM, Matthew Flatt mfl...@cs.utah.edu wrote:
 Hi Jan,

 Interesting problem!

 I think I see what you mean: There's no way to combine the completion
 of an event plus saving its value as an atomic operation, except by
 putting the synchronization in its own thread. But if you put the
 synchronization in its own thread, then there's no way to prevent that
 thread's synchronization when a consumer synchronization (i.e., one
 that is waiting for the thread's result) picks a different event than
 the one represented by the thread.

 It's easy to make a complete+save combination atomic if it's built into
 the scheduler. So, I can easily imagine adding a simpler primitive,
 `once-evt`. The event OE created by `(once-evt E)` could save the first
 result produced by E, but not attempt to have only a single wait on E.
 That is, if OE1 is synchronized in multiple threads, then it would be
 like synchronizing E in multiple threads, but only the first result
 from E will be saved.

 Unfortunately, `once-evt` isn't enough to implement `memoize-evt`. The
 troublesome case is then thread T1 is synchronizing on OE1, T1 gets
 suspended, and T2 starts waiting on OE1. In that case, you'd like T2 to
 take over the wait, even if it means restarting E. You can detect that
 T1 is suspended and have T2 start waiting on E, but there's no way to
 cancel the wait of E in T1.

 Building `memoize-evt` into the core doesn't the avoid the need to, at
 some level, cancel T1's wait on E. I'll keep thinking about it, but it
 looks like that would require deep changes to the scheduler.

 Would the simpler `once-evt` work in your situation, or do you need the
 guarantee that only one wait of E happens at a time?

 Matthew

 At Wed, 28 Jan 2015 13:49:51 +0100, Jan Dvořák wrote:
 Hi,

 I would like to ask for another extension of the Racket's event handling
 system. A `memoize-evt` constructor with following semantics:

 Given a base event E_b, memoize-evt will produce a memoizing event E_m.
 Synchronizing on E_m from any number of threads will block until a
 single value is produced by E_b. This value is then stored inside the
 E_m. From that moment on, E_m will always be immediately ready for
 synchronization and produce the stored value in all waiting threads.

 The single-threaded implementation is a trivial guard-evt + replace-evt
 + (wrap-evt always-evt) combo, but for thread-safety a temporary thread
 would be needed to wait for the base event and the solution would have
 different semantics then rest of the event system.

 A lower-level approach would also be possible; create something along
 the lines of a dynamic-wind-evt that would, with some cleverness, allow
 for generic thread-safe events via locking. Or create a locked-wrap-evt
 constructor that will not be ready until it's handler finishes.

 Hoping that I am not being too bothersome,
 from Prague with thanks,
 Jan Dvorak


 _
   Racket Developers list:
   http://lists.racket-lang.org/dev

_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] A proposal for parametric opaque types in Typed Racket

2015-01-29 Thread Alexis King
I think you’re reading too far into what I’m proposing, though I admit I 
probably didn’t give enough context. I’ve been talking with Sam about this 
issue on IRC, so he knows what I’m talking about, but I’ll try and clarify here.

This entire thing is just a fix for the problem described in Section 2 
http://lexi-lambda.github.io/racket-parametric-opaque-types/#(part._.Extending_parametricity_to_opaque_types).
 When using require/typed to import “opaque” types from untyped code, the 
imported types cannot be polymorphic. This entire proposal is simply a way to 
make that possible.

In Section 2.1, A is used in a number of places, but it is just a type 
parameter. See the typed struct definition in Section 1. A does not refer to a 
specific type but any type. Posn essentially becomes a new type combinator than 
can make new types by supplying it with any other type.

The other functions imported in Section 2.1 simply make use of Typed Racket’s 
polymorphic type utilities to make use of the fact that Posn is now a 
polymorphic type. The concepts here are simple. No semantics are being changed, 
it’s just extending parameterization to opaque types.

Sections 2.3 and 2.2, in contrast, are simply describing mechanisms for 
implementing the functionality outlined in 2.1.

Now to answer your points.

 - Should an A only be a base type like String or Symbol

A can by any type. It’s a type parameter. (Posn A) is like (Boxof A).

 - Do you mean to infer the type of the first thing put into the struct as the 
 exact type for everything else?

No, not really. Remember that Posn is an opaque type. TR has no idea it’s 
actually implemented as a struct. Perhaps the JSExpr example given in Section 3 
will help to illustrate that generality. This will just leverage the existing 
polymorphic type inference mechanisms TR already provides.

 - Would first class members prevent me from filling a struct with members 
 of (define-type (Option A) (U 'None (Some A))), where Some is a struct with 
 one field?

No, as I said, you can supply any type for A. By “first class member” of the 
type system, I simply meant that these types would have to be built-in to TR as 
a special case—they cannot be derived from the existing type constructs 
provided by TR. This is similar to how structure types are “first class” in 
TR—the struct form is “magical” and cannot be reimplemented in terms of other 
TR primitives.

I hope that helps to make things a little more clear.

 On Jan 29, 2015, at 19:44, Benjamin Greenman bl...@cornell.edu wrote:
 
 This has bothered me too, but I've realized that I was on the wrong track.
 
 The string a and symbol 'b are not different types. A struct (Foo a 'b), 
 or (list a 'b), is a homogeneous data structure of type (U String Symbol) 
 just like Alexander said. This really upsets me -- I like the Hindley Milner 
 world where the compiler warns me if I make a list [1, two] and forces me 
 to wrap the int and string into a new datatype. But Typed Racket is not HM.
 
 About the proposal, I'm confused about what the syntax in Section 2.1 should 
 do -- what is a first class member of Typed Racket's type system?
 - Should an A only be a base type like String or Symbol
 - Do you mean to infer the type of the first thing put into the struct as the 
 exact type for everything else?
 - Would first class members prevent me from filling a struct with members 
 of (define-type (Option A) (U 'None (Some A))), where Some is a struct with 
 one field?
 
 I totally agree that something needs fixing, but I'm not sure what.
 
 
 
 On Thu, Jan 29, 2015 at 10:13 PM, Alexis King lexi.lam...@gmail.com 
 mailto:lexi.lam...@gmail.com wrote:
 Or Any for that matter. I know. The fact that it could be literally anything 
 was sort of the point.
 
 On Jan 29, 2015, at 19:10, Alexander D. Knauth alexan...@knauth.org 
 mailto:alexan...@knauth.org wrote:
 
 Um, for this:
 (module 
 http://docs.racket-lang.org/reference/module.html#%28form._%28%28quote._~23~25kernel%29._module%29%29
  typed typed/racket/base
 (provide 
 http://docs.racket-lang.org/reference/require.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._provide%29%29
  (struct-out 
 http://docs.racket-lang.org/reference/require.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._struct-out%29%29
  Foo))
 (struct 
 http://docs.racket-lang.org/ts-reference/special-forms.html#%28form._%28%28lib._typed-racket%2Fbase-env%2Fprims..rkt%29._struct%29%29
  [A] Foo ([x : 
 http://docs.racket-lang.org/ts-reference/special-forms.html#%28form._%28%28lib._typed-racket%2Fbase-env%2Fprims..rkt%29._~3a%29%29
  A] [y : 
 http://docs.racket-lang.org/ts-reference/special-forms.html#%28form._%28%28lib._typed-racket%2Fbase-env%2Fprims..rkt%29._~3a%29%29
  A]) #:transparent))
 
 (Foo a 'b)
 Should be fine because Foo could be instantiated at the type (U String 
 Symbol).
 
 On Jan 29, 2015, at 9:25 PM, Alexis King lexi.lam...@gmail.com 
 mailto:lexi.lam...@gmail.com wrote:
 
 I 

Re: [racket-dev] A proposal for parametric opaque types in Typed Racket

2015-01-29 Thread Alexander D. Knauth

On Jan 29, 2015, at 11:34 PM, Alexis King lexi.lam...@gmail.com wrote:

 But the problem is that if it’s an opaque type then it can’t unwrap it once 
 the value is returned from make-posn.
 
 Yes, that’s precisely the problem. Your point about implementing everything 
 as single-valued structs on the typed side is an interesting one, though I 
 don’t think it ultimately solves any problems. The fact that the typed side 
 knows nothing about the contents of the value is what makes this such a 
 tricky problem.
 
 As for this:
 
 But then you couldn’t do any operations on it except those that you use 
 import with require/typed, right?
 
 That’s completely correct. That’s why it’s “opaque.”
 
 And what happens if you use cast on one of these things?
 
 That’s a little more interesting. Using cast on an object of this type would 
 never fail (unless, of course, it didn’t actually satisfy the basic posn? 
 predicate), but it would possibly introduce failures in the future since it 
 would affect the contracts generated for posn-x and posn-y, for example.
 
 To make that more clear, casting a (Posn Real) to a (Posn String) would work 
 fine until you tried to call posn-x on the instance, in which case it would 
 raise a contract error. Note that this isn’t really any different from 
 casting mutable data types.

But if it were wrapped in an opaque structure, then that structure wouldn’t 
satisfy the posn? predicate, unless of course the posn? predicate has a 
contract that unwraps it.  So all of the operations on it would have to have 
contracts that would unwrap it.  This might actually make sense if the type is 
meant to be actually opaque, but if it’s an opaque type that represents a 
normal non-opaque value, then it will still work as an opaque type, but it 
won’t be a normal non-opaque value anymore on the typed side.  

But the reason I asked about cast was because normally I can use cast with a 
value that has an opaque type, but it’s wrapped on the typed side in this 
opaque structure, then the contracts on the cast would see this opaque 
structure instead of the actual value.  

I’m thinking of an opaque typed representing a string with length 1, which I 
can use as long as I use either (cast x String) or (assert x string?) whenever 
I pass it to a string operation.  But if it were an opaque type, I don’t think 
I could do that.  There could be a 1string-string function that could take one 
of these 1strings and convert it to a string, but that seems like it should be 
unnecessary, but made necessary by this opaque structure thing.  

And for “this isn’t really any different from casting mutable data types,” look 
at this:
#lang typed/racket
(: b : (Boxof Number))
(define b (box 1))
(set-box! (cast b (Boxof (U Number String))) I am a string)
(ann (unbox b) Number) ;I am a string” ; not a contract error


 
 On Jan 29, 2015, at 20:20, Alexander D. Knauth alexan...@knauth.org wrote:
 
 Furthermore, even if the wrappers were shared between functions, untyped 
 code would recieved wrapped values, which would render them quite useless.
 
 If it’s not an opaque type, but something like a list, then this works, and 
 the untyped code receiving wrapped values isn’t a problem here:
 #lang typed/racket
 ; make Posn parametric
 (define-type (Posn A) (List A A))
 (provide Posn)
 (require/typed/provide
  untyped.rkt
  [make-posn (All (A) A A - (Posn A))]
  [posn-x (All (A) (Posn A) - A)]
  [posn-y (All (A) (Posn A) - A)]
  [real-posn? [(Posn Any) - Boolean]])
  (define p (make-posn 1 2))
 (make-posn #A6 #A6) ; a printf that I put in make-posn from “untyped.rkt
  p
 - : (Listof Positive-Byte) [more precisely: (List Positive-Byte 
 Positive-Byte)]
 '(1 2) ; unwrapped
  (posn-x p)
 - : Integer [more precisely: Positive-Byte]
 1
  (posn-y p)
 - : Integer [more precisely: Positive-Byte]
 2
  (real-posn? p)
 - : Boolean
 #t
 
 Even though for a short time it's wrapped, it’s unwrapped as soon as 
 make-posn returns, and then after that if it flows into untyped code again 
 it’s not wrapped and functions like real-posn? work fine.  
 
 But the problem is that if it’s an opaque type then it can’t unwrap it once 
 the value is returned from make-posn.
 
 And I don’t think parametric opaque types could solve this unless all posns 
 themselves were wrapped with an opaque struct on the typed side, which I 
 guess does make sense now that I think about it.  But then you couldn’t do 
 any operations on it except those that you use import with require/typed, 
 right?  Or not?  And what happens if you use cast on one of these things?
 
 
 On Jan 29, 2015, at 9:25 PM, Alexis King lexi.lam...@gmail.com wrote:
 
 I recently ran into a problem in which opaque types (types imported from 
 untyped code) cannot by parameterized by Typed Racket. I initially 
 encountered this problem in my attempt to port 2htdp/image to TR.
 
 After some further consideration, I’m interested in adding support to make 
 something like this possible, which 

Re: [racket-dev] A proposal for parametric opaque types in Typed Racket

2015-01-29 Thread Alexander D. Knauth
Um, for this:
(module typed typed/racket/base
(provide (struct-out Foo))
(struct [A] Foo ([x : A] [y : A]) #:transparent))

(Foo a 'b)
Should be fine because Foo could be instantiated at the type (U String Symbol).

On Jan 29, 2015, at 9:25 PM, Alexis King lexi.lam...@gmail.com wrote:

 I recently ran into a problem in which opaque types (types imported from 
 untyped code) cannot by parameterized by Typed Racket. I initially 
 encountered this problem in my attempt to port 2htdp/image to TR.
 
 After some further consideration, I’m interested in adding support to make 
 something like this possible, which would certainly have additional benefits 
 beyond this specific use-case. I’ve outlined my proposal here:
 http://lexi-lambda.github.io/racket-parametric-opaque-types/
 
 Any feedback, suggestions, or advice would be appreciated, especially from 
 those who are familiar with Typed Racket’s internals.
 
 Thank you,
 Alexis
 _
  Racket Developers list:
  http://lists.racket-lang.org/dev

_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] build memory use (was: internal error during gc)

2015-01-29 Thread Philippe Meunier
Matthew Flatt wrote:
We've so far cut the peak memory use of a build by about 1/4 compared
to a v6.1.1 build.

Yes, peak memory use for me has now dropped from about 900MB to just
below 700MB.  Veeery nice :-)

Philippe


_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] A proposal for parametric opaque types in Typed Racket

2015-01-29 Thread Alexis King
 But the problem is that if it’s an opaque type then it can’t unwrap it once 
 the value is returned from make-posn.

Yes, that’s precisely the problem. Your point about implementing everything as 
single-valued structs on the typed side is an interesting one, though I don’t 
think it ultimately solves any problems. The fact that the typed side knows 
nothing about the contents of the value is what makes this such a tricky 
problem.

As for this:

 But then you couldn’t do any operations on it except those that you use 
 import with require/typed, right?

That’s completely correct. That’s why it’s “opaque.”

 And what happens if you use cast on one of these things?

That’s a little more interesting. Using cast on an object of this type would 
never fail (unless, of course, it didn’t actually satisfy the basic posn? 
predicate), but it would possibly introduce failures in the future since it 
would affect the contracts generated for posn-x and posn-y, for example.

To make that more clear, casting a (Posn Real) to a (Posn String) would work 
fine until you tried to call posn-x on the instance, in which case it would 
raise a contract error. Note that this isn’t really any different from casting 
mutable data types.

 On Jan 29, 2015, at 20:20, Alexander D. Knauth alexan...@knauth.org wrote:
 
 Furthermore, even if the wrappers were shared between functions, untyped code 
 would recieved wrapped values, which would render them quite useless.
 
 If it’s not an opaque type, but something like a list, then this works, and 
 the untyped code receiving wrapped values isn’t a problem here:
 #lang typed/racket
 ; make Posn parametric
 (define-type (Posn A) (List A A))
 (provide Posn)
 (require/typed/provide
  untyped.rkt
  [make-posn (All (A) A A - (Posn A))]
  [posn-x (All (A) (Posn A) - A)]
  [posn-y (All (A) (Posn A) - A)]
  [real-posn? [(Posn Any) - Boolean]])
  (define p (make-posn 1 2))
 (make-posn #A6 #A6) ; a printf that I put in make-posn from “untyped.rkt
  p
 - : (Listof Positive-Byte) [more precisely: (List Positive-Byte 
 Positive-Byte)]
 '(1 2) ; unwrapped
  (posn-x p)
 - : Integer [more precisely: Positive-Byte]
 1
  (posn-y p)
 - : Integer [more precisely: Positive-Byte]
 2
  (real-posn? p)
 - : Boolean
 #t
 
 Even though for a short time it's wrapped, it’s unwrapped as soon as 
 make-posn returns, and then after that if it flows into untyped code again 
 it’s not wrapped and functions like real-posn? work fine.  
 
 But the problem is that if it’s an opaque type then it can’t unwrap it once 
 the value is returned from make-posn.
 
 And I don’t think parametric opaque types could solve this unless all posns 
 themselves were wrapped with an opaque struct on the typed side, which I 
 guess does make sense now that I think about it.  But then you couldn’t do 
 any operations on it except those that you use import with require/typed, 
 right?  Or not?  And what happens if you use cast on one of these things?
 
 
 On Jan 29, 2015, at 9:25 PM, Alexis King lexi.lam...@gmail.com 
 mailto:lexi.lam...@gmail.com wrote:
 
 I recently ran into a problem in which opaque types (types imported from 
 untyped code) cannot by parameterized by Typed Racket. I initially 
 encountered this problem in my attempt to port 2htdp/image to TR 
 https://github.com/lexi-lambda/racket-2htdp-typed/issues/1.
 
 After some further consideration, I’m interested in adding support to make 
 something like this possible, which would certainly have additional benefits 
 beyond this specific use-case. I’ve outlined my proposal here:
 http://lexi-lambda.github.io/racket-parametric-opaque-types/ 
 http://lexi-lambda.github.io/racket-parametric-opaque-types/
 
 Any feedback, suggestions, or advice would be appreciated, especially from 
 those who are familiar with Typed Racket’s internals.
 
 Thank you,
 Alexis
 _
  Racket Developers list:
  http://lists.racket-lang.org/dev http://lists.racket-lang.org/dev
 

_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] A proposal for parametric opaque types in Typed Racket

2015-01-29 Thread Benjamin Greenman
This has bothered me too, but I've realized that I was on the wrong track.

The string a and symbol 'b are not different types. A struct (Foo a
'b), or (list a 'b), is a homogeneous data structure of type (U String
Symbol) just like Alexander said. This really upsets me -- I like the
Hindley Milner world where the compiler warns me if I make a list [1,
two] and forces me to wrap the int and string into a new datatype. But
Typed Racket is not HM.

About the proposal, I'm confused about what the syntax in Section 2.1
should do -- what is a first class member of Typed Racket's type system?
- Should an A only be a base type like String or Symbol
- Do you mean to infer the type of the first thing put into the struct as
the exact type for everything else?
- Would first class members prevent me from filling a struct with members
of (define-type (Option A) (U 'None (Some A))), where Some is a struct
with one field?

I totally agree that something needs fixing, but I'm not sure what.



On Thu, Jan 29, 2015 at 10:13 PM, Alexis King lexi.lam...@gmail.com wrote:

 Or Any for that matter. I know. The fact that it could be literally
 anything was sort of the point.

 On Jan 29, 2015, at 19:10, Alexander D. Knauth alexan...@knauth.org
 wrote:

 Um, for this:
 (module
 http://docs.racket-lang.org/reference/module.html#%28form._%28%28quote._~23~25kernel%29._module%29%29
  typed typed/racket/base(provide
 http://docs.racket-lang.org/reference/require.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._provide%29%29
  (struct-out
 http://docs.racket-lang.org/reference/require.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._struct-out%29%29
  Foo))(struct
 http://docs.racket-lang.org/ts-reference/special-forms.html#%28form._%28%28lib._typed-racket%2Fbase-env%2Fprims..rkt%29._struct%29%29
  [A] Foo ([x :
 http://docs.racket-lang.org/ts-reference/special-forms.html#%28form._%28%28lib._typed-racket%2Fbase-env%2Fprims..rkt%29._~3a%29%29
  A] [y :
 http://docs.racket-lang.org/ts-reference/special-forms.html#%28form._%28%28lib._typed-racket%2Fbase-env%2Fprims..rkt%29._~3a%29%29
  A]) #:transparent))

 (Foo a 'b)
 Should be fine because Foo could be instantiated at the type (U String
 Symbol).

 On Jan 29, 2015, at 9:25 PM, Alexis King lexi.lam...@gmail.com wrote:

 I recently ran into a problem in which opaque types (types imported from
 untyped code) cannot by parameterized by Typed Racket. I initially
 encountered this problem in my attempt to port 2htdp/image to TR
 https://github.com/lexi-lambda/racket-2htdp-typed/issues/1.

 After some further consideration, I’m interested in adding support to make
 something like this possible, which would certainly have additional
 benefits beyond this specific use-case. I’ve outlined my proposal here:
 http://lexi-lambda.github.io/racket-parametric-opaque-types/

 Any feedback, suggestions, or advice would be appreciated, especially from
 those who are familiar with Typed Racket’s internals.

 Thank you,
 Alexis
 _
  Racket Developers list:
  http://lists.racket-lang.org/dev




 _
   Racket Developers list:
   http://lists.racket-lang.org/dev


_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] A proposal for parametric opaque types in Typed Racket

2015-01-29 Thread Alexander D. Knauth
Furthermore, even if the wrappers were shared between functions, untyped code 
would recieved wrapped values, which would render them quite useless.

If it’s not an opaque type, but something like a list, then this works, and the 
untyped code receiving wrapped values isn’t a problem here:
#lang typed/racket
; make Posn parametric
(define-type (Posn A) (List A A))
(provide Posn)
(require/typed/provide
 untyped.rkt
 [make-posn (All (A) A A - (Posn A))]
 [posn-x (All (A) (Posn A) - A)]
 [posn-y (All (A) (Posn A) - A)]
 [real-posn? [(Posn Any) - Boolean]])
 (define p (make-posn 1 2))
(make-posn #A6 #A6) ; a printf that I put in make-posn from “untyped.rkt
 p
- : (Listof Positive-Byte) [more precisely: (List Positive-Byte Positive-Byte)]
'(1 2) ; unwrapped
 (posn-x p)
- : Integer [more precisely: Positive-Byte]
1
 (posn-y p)
- : Integer [more precisely: Positive-Byte]
2
 (real-posn? p)
- : Boolean
#t

Even though for a short time it's wrapped, it’s unwrapped as soon as make-posn 
returns, and then after that if it flows into untyped code again it’s not 
wrapped and functions like real-posn? work fine.  

But the problem is that if it’s an opaque type then it can’t unwrap it once the 
value is returned from make-posn.

And I don’t think parametric opaque types could solve this unless all posns 
themselves were wrapped with an opaque struct on the typed side, which I guess 
does make sense now that I think about it.  But then you couldn’t do any 
operations on it except those that you use import with require/typed, right?  
Or not?  And what happens if you use cast on one of these things?


On Jan 29, 2015, at 9:25 PM, Alexis King lexi.lam...@gmail.com wrote:

 I recently ran into a problem in which opaque types (types imported from 
 untyped code) cannot by parameterized by Typed Racket. I initially 
 encountered this problem in my attempt to port 2htdp/image to TR.
 
 After some further consideration, I’m interested in adding support to make 
 something like this possible, which would certainly have additional benefits 
 beyond this specific use-case. I’ve outlined my proposal here:
 http://lexi-lambda.github.io/racket-parametric-opaque-types/
 
 Any feedback, suggestions, or advice would be appreciated, especially from 
 those who are familiar with Typed Racket’s internals.
 
 Thank you,
 Alexis
 _
  Racket Developers list:
  http://lists.racket-lang.org/dev

_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] A proposal for parametric opaque types in Typed Racket

2015-01-29 Thread Alexis King
Or Any for that matter. I know. The fact that it could be literally anything 
was sort of the point.

 On Jan 29, 2015, at 19:10, Alexander D. Knauth alexan...@knauth.org wrote:
 
 Um, for this:
 (module 
 http://docs.racket-lang.org/reference/module.html#%28form._%28%28quote._~23~25kernel%29._module%29%29
  typed typed/racket/base
 (provide 
 http://docs.racket-lang.org/reference/require.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._provide%29%29
  (struct-out 
 http://docs.racket-lang.org/reference/require.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._struct-out%29%29
  Foo))
 (struct 
 http://docs.racket-lang.org/ts-reference/special-forms.html#%28form._%28%28lib._typed-racket%2Fbase-env%2Fprims..rkt%29._struct%29%29
  [A] Foo ([x : 
 http://docs.racket-lang.org/ts-reference/special-forms.html#%28form._%28%28lib._typed-racket%2Fbase-env%2Fprims..rkt%29._~3a%29%29
  A] [y : 
 http://docs.racket-lang.org/ts-reference/special-forms.html#%28form._%28%28lib._typed-racket%2Fbase-env%2Fprims..rkt%29._~3a%29%29
  A]) #:transparent))
 
 (Foo a 'b)
 Should be fine because Foo could be instantiated at the type (U String 
 Symbol).
 
 On Jan 29, 2015, at 9:25 PM, Alexis King lexi.lam...@gmail.com 
 mailto:lexi.lam...@gmail.com wrote:
 
 I recently ran into a problem in which opaque types (types imported from 
 untyped code) cannot by parameterized by Typed Racket. I initially 
 encountered this problem in my attempt to port 2htdp/image to TR 
 https://github.com/lexi-lambda/racket-2htdp-typed/issues/1.
 
 After some further consideration, I’m interested in adding support to make 
 something like this possible, which would certainly have additional benefits 
 beyond this specific use-case. I’ve outlined my proposal here:
 http://lexi-lambda.github.io/racket-parametric-opaque-types/ 
 http://lexi-lambda.github.io/racket-parametric-opaque-types/
 
 Any feedback, suggestions, or advice would be appreciated, especially from 
 those who are familiar with Typed Racket’s internals.
 
 Thank you,
 Alexis
 _
  Racket Developers list:
  http://lists.racket-lang.org/dev http://lists.racket-lang.org/dev
 

_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] A proposal for parametric opaque types in Typed Racket

2015-01-29 Thread Alexis King
It isn’t wrapped in an opaque structure. That wasn’t a part of my proposal, and 
while I didn’t think of it until you brought it up, I still think it’s 
unnecessary and doesn’t add any convenience.

Perhaps I’m not understanding you properly, but your “one-length string” idea 
sounds like it has little to do with this opaque type problem and more to do 
with the fact that you want refinement types in Typed Racket. I do, too! But I 
don’t think hacking the opaque type system is going to help you with that.

(Also, as for the box example, I’m actually a little surprised that doesn’t 
contract error. Seems like a bug to me, but perhaps I’m missing some 
idiosyncrasies of the type system. Either way, it’s precisely that kind of 
craziness I was referring to when I compared casting parametric opaque types to 
casting mutable types.)

 On Jan 29, 2015, at 20:50, Alexander D. Knauth alexan...@knauth.org wrote:
 
 
 On Jan 29, 2015, at 11:34 PM, Alexis King lexi.lam...@gmail.com 
 mailto:lexi.lam...@gmail.com wrote:
 
 But the problem is that if it’s an opaque type then it can’t unwrap it once 
 the value is returned from make-posn.
 
 Yes, that’s precisely the problem. Your point about implementing everything 
 as single-valued structs on the typed side is an interesting one, though I 
 don’t think it ultimately solves any problems. The fact that the typed side 
 knows nothing about the contents of the value is what makes this such a 
 tricky problem.
 
 As for this:
 
 But then you couldn’t do any operations on it except those that you use 
 import with require/typed, right?
 
 That’s completely correct. That’s why it’s “opaque.”
 
 And what happens if you use cast on one of these things?
 
 That’s a little more interesting. Using cast on an object of this type would 
 never fail (unless, of course, it didn’t actually satisfy the basic posn? 
 predicate), but it would possibly introduce failures in the future since it 
 would affect the contracts generated for posn-x and posn-y, for example.
 
 To make that more clear, casting a (Posn Real) to a (Posn String) would work 
 fine until you tried to call posn-x on the instance, in which case it would 
 raise a contract error. Note that this isn’t really any different from 
 casting mutable data types.
 
 But if it were wrapped in an opaque structure, then that structure wouldn’t 
 satisfy the posn? predicate, unless of course the posn? predicate has a 
 contract that unwraps it.  So all of the operations on it would have to have 
 contracts that would unwrap it.  This might actually make sense if the type 
 is meant to be actually opaque, but if it’s an opaque type that represents a 
 normal non-opaque value, then it will still work as an opaque type, but it 
 won’t be a normal non-opaque value anymore on the typed side.  
 
 But the reason I asked about cast was because normally I can use cast with a 
 value that has an opaque type, but it’s wrapped on the typed side in this 
 opaque structure, then the contracts on the cast would see this opaque 
 structure instead of the actual value.  
 
 I’m thinking of an opaque typed representing a string with length 1, which I 
 can use as long as I use either (cast x String) or (assert x string?) 
 whenever I pass it to a string operation.  But if it were an opaque type, I 
 don’t think I could do that.  There could be a 1string-string function that 
 could take one of these 1strings and convert it to a string, but that seems 
 like it should be unnecessary, but made necessary by this opaque structure 
 thing.  
 
 And for “this isn’t really any different from casting mutable data types,” 
 look at this:
 #lang typed/racket
 (: b : (Boxof Number))
 (define b (box 1))
 (set-box! (cast b (Boxof (U Number String))) I am a string)
 (ann (unbox b) Number) ;I am a string” ; not a contract error
 
 
 
 On Jan 29, 2015, at 20:20, Alexander D. Knauth alexan...@knauth.org 
 mailto:alexan...@knauth.org wrote:
 
 Furthermore, even if the wrappers were shared between functions, untyped 
 code would recieved wrapped values, which would render them quite useless.
 
 If it’s not an opaque type, but something like a list, then this works, and 
 the untyped code receiving wrapped values isn’t a problem here:
 #lang typed/racket
 ; make Posn parametric
 (define-type (Posn A) (List A A))
 (provide Posn)
 (require/typed/provide
  untyped.rkt
  [make-posn (All (A) A A - (Posn A))]
  [posn-x (All (A) (Posn A) - A)]
  [posn-y (All (A) (Posn A) - A)]
  [real-posn? [(Posn Any) - Boolean]])
  (define p (make-posn 1 2))
 (make-posn #A6 #A6) ; a printf that I put in make-posn from 
 “untyped.rkt
  p
 - : (Listof Positive-Byte) [more precisely: (List Positive-Byte 
 Positive-Byte)]
 '(1 2) ; unwrapped
  (posn-x p)
 - : Integer [more precisely: Positive-Byte]
 1
  (posn-y p)
 - : Integer [more precisely: Positive-Byte]
 2
  (real-posn? p)
 - : Boolean
 #t
 
 Even though for a short time it's wrapped, it’s unwrapped as soon as 
 make-posn returns, and 

Re: [racket-dev] feature request: thread-safe memoize-evt

2015-01-29 Thread Jan Dvořák
On Thu, 2015-01-29 at 16:41 -0600, Robby Findler wrote:
 That is, I thought you could just create a separate thread that sync's
 on E_b and then whenever you get a value from it, then the E_m would
 just continue to produce that all the time. But I think you're saying
 that wouldn't work?

The problem is that the auxiliary thread would always wait for the E_b,
even when nobody is interested in the result anymore. Moreover, putting
the wait in another thread would require the E_b to be thread safe.

_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] dev Digest, Vol 72, Issue 31

2015-01-28 Thread Byron Davies
My apologies, especially to Matt, for letting this thread go cold.  I was
busy preparing a Racket-based demo for this morning -- and it went very
well.  As mentioned, I'm working on weakest precondition analysis for
finding latent faults in programs. Our goal is to do this for all kinds of
software, including machine language, but for proof of concept I'm doing it
*in* Racket *on* Racket programs.  Racket's language building tools,
including syntax and the syntax browser, have been very useful for this
problem.

Regarding transparency, thank you, Matt, for suggesting an alternative
approach.  I've played with your examples a bit, trying to see how I could
use this during debugging.  I have also read the Reflection and Security
chapter in the reference to learn more about inspectors in general.

Your code, commented:

(define orig-i (current-inspector))  ; saves the original inspector
(define sub-i (make-inspector orig-i))  ;make a new inspector whose parent
is the original inspector

(current-inspector sub-i)  ;makes the new inspector the current inspector
(struct a (x))  ; creates a structure using the new inspector as the
default inspector
(define v (a 1))  ; creates an instance of the new structure
(current-inspector orig-i) ;reverts the inspector to the original (the
parent of the new inspector)

I see how this works, but I'm a little confused about why it works.  I see
that the new inspector is a child of the old one, and I read in the
reference chapter that access is determined not by the inspector in force
at creation time, but by the parent of that inspector, i.e., the old
inspector. I can't find any description of the power of an inspector,
except that the parent is more powerful.

Are there degrees of power? Or if you have access to the parent do you have
all the power you can have? I see that the inspector gives you access to
the data in a structure instance, but does it also give you access to
meta-data, so that I know that the name of the first field in struct a is x?

I also don't understand how the root inspector works.  I have found that
setting (current-inspector root-inspector) delivers endless left parens for
the (a 1) example, presumably because the display function recursively
tries to inspect the components of the struct, all the way down.

Finally, does this also work for classes?

Date: Thu, 22 Jan 2015 05:36:18 -0700
From: Matthew Flatt mfl...@cs.utah.edu
To: Byron Davies byrondav...@starshine.us
Cc: dev@racket-lang.org
Subject: Re: [racket-dev] Full transparency
Message-ID: 20150122123620.2daa1650...@mail-svr1.cs.utah.edu
Content-Type: text/plain; charset=UTF-8

I don't think you want to do anything with the compiler or macros.
Instead, it's a matter of having a sufficiently powerful inspector
(which is the concept of inspectability turned into a language
construct).

If you have just

 (struct a (x))
 (a 1)

then the result will print as `#a`. But if you use

 (define orig-i (current-inspector))
 (define sub-i (make-inspector orig-i))

 (current-inspector sub-i)
 (struct a (x))
 (define v (a 1))
 (current-inspector orig-i)

 v

Then, the result will print as `(a 1)`. That's because the structure
declaration is creates under an inspector `sub-i` (which is the current
inspector at the time) that is subordinate to the inspector `orig-i`
that is in place when the structure instance is printed.

The current inspector is determined dynamically, which means that if
you're loading some code, you can set the inspector while loading the
code. For example, if a.rkt is

 #lang racket/base
 (provide v)

 (struct a (x))
 (define v (a 1))

then

 (define v
   (parameterize ([current-inspector (make-inspector)])
 (dynamic-require a.rkt 'v)))
 v

will print the `a` instance transparently.


To protect libraries, there's no safe way to access a root inspector
that controls all structure types when you start Racket. Nothing is
safe from unsafe code, though, and here's an unsafe way to access the
root inspector:

 #lang racket/base
 (require ffi/unsafe)

 (define-cstruct _Scheme_Inspector
   ([stag _short]
[keyex _short]
[depth _int]
[superior _racket]))

 (define root-inspector
   (Scheme_Inspector-superior
((get-ffi-obj 'scheme_get_initial_inspector
  #f
  (_fun - (_gcable _Scheme_Inspector-pointer))

Using `root-inspector`, you can inspect any structure instance.

At Wed, 21 Jan 2015 23:46:10 -0700, Byron Davies wrote:
 Nice parry!  What may be straightforward to you may not be so obvious to
 me.  But I'll take a look.

 I'm deep into a project using Racket for weakest precondition analysis.
 Every time I'm debugging it seems like I have to write another
 special-purpose accessor, or export some existing accessor up through
 multiple levels in order to get at the data I need at the top-level.  I
 remember how easy it was with the Lisp Machine to navigate through data no
 matter what it was.

 The Lisp Machine offered total transparency

Re: [racket-dev] Switching to Google Groups

2015-01-28 Thread Vincent St-Amour
In case anyone would like to use a non-gmail address for sign up, you
can sign up from this URL:
https://groups.google.com/forum/#!forum/racket-dev/join

The regular sign up button wouldn't let me.

Vincent


At Wed, 28 Jan 2015 16:47:58 -0800,
John Clements wrote:
 
 
 Dear developers,
 
 PLT would like to get out of the mailing-list administration game.
 
 Accordingly, we’re planning to switch to Google Groups. Rather than
 starting with our largest list, the Racket Users list, we’ve chosen to
 begin with the dev list, because … well, you’re probably more tolerant,
 if^H^H when something goes wrong.
 
 We would like the transition to be as smooth as possible, and we can use
 your help with this. Specifically, Google has a daily cap on the number
 of e-mail addresses that can be bulk-added to a mailing list. For this
 reason, it would speed the transition greatly if you could take a moment
 to sign up for the new group yourself, using this URL:
 
 https://groups.google.com/forum/#!forum/racket-dev
 
 We plan to disable signup for the old group now, and to halt delivery of
 mail to the existing group address tomorrow. You can post to the new
 group (after signing up) by sending mail to
 
 racket-...@googlegroups.com
 
 We plan to manually add or invite the members who do not add themselves,
 but the daily cap will mean that these users are likely to miss one or
 more days of postings to this list. Naturally, those posts will be
 archived, as part of the group.
 
 The archive of the existing list will continue to exist, though new
 messages will not be added to it.
 
 Let us know if you run into problems!
 
 Many thanks,
 
 John Clements  PLT
 _
   Racket Developers list:
   http://lists.racket-lang.org/dev
_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] Fwd: Sandbox evaluation problem - files with comment boxes

2015-01-27 Thread Matthew Flatt
Yes, it's a bug in v6.1.1. I've just pushed a repair for the next
build.

Do you need a workaround for v6.1.1? Your variant that sets
`sandbox-namespace-specs` is what I would have tried; unfortunately,
that runs into a second bug in v6.1.1 that I recently fixed. If you
need a workaround other than using the next snapshot, I can look harder
for one.

Thanks for the report!

At Mon, 26 Jan 2015 21:27:31 -0500, Nadeem Abdul Hamid wrote:
 Ah, I am still struggling with this sandbox problem! (previous message to
 'users' below) I'm starting to feel like maybe there's a bug in 6.1.1, or
 else something changed in recent versions that I'm missing. The following
 screenshots show the entire contents of the BSL file that I'm trying to
 load using make-module-evaluator, with gracket v6.1.1 failing the second
 time you try to load the file (or another one) that contains a comment box,
 while racket v6.1.1 and gracket 6.0 don't have this behavior:
 
 http://cs.berry.edu/~nhamid/temp/foo.png
 http://cs.berry.edu/~nhamid/temp/foo60.png
 
 ???
 
 --- nadeem
 
 
 
 -- Forwarded message --
 From: Nadeem Abdul Hamid nad...@acm.org
 Date: Sun, Jan 25, 2015 at 10:35 PM
 Subject: Sandbox evaluation problem - files with comment boxes
 To: users us...@racket-lang.org
 
 
 
 I'm trying to create a simple sandbox evaluator (to load in programs in
 *SL). I have the following code:
 
 #lang racket
 (require racket/sandbox)
 (define E
   (parameterize ([sandbox-path-permissions
   '([write /var/folders]
 [exists /]
 [read /])]
  )
 (make-module-evaluator (string-path test-file.rkt
 
 
 This works fine as long as test-file.rkt does *not* contain a comment box.
 If the file contains a comment box, then the following error occurs:
 
 /Applications/Racket
 v6.1.1/share/pkgs/snip-lib/racket/snip/private/load-one.rkt:21:2:
 dynamic-require: unknown module
   module name: #resolved-module-path:/Applications/Racket
 v6.1.1/share/pkgs/gui-lib/framework/main.rkt
 
 
 
 I thought maybe parameterizing sandbox-namespace-specs with 'framework
 might do something:
 
 (require racket/sandbox racket/gui)
 (define E
   (parameterize ([sandbox-path-permissions
   '([write /var/folders]
 [exists /]
 [read /])]
  [sandbox-namespace-specs
   (list make-gui-namespace 'framework)]
  )
 (make-module-evaluator (string-path lab01-insulin.rkt
 
 But it results in:
namespace-attach-module: a different instance of the same module is
 already in the destination namespace
   module name: /Applications/Racket
 v6.1.1/collects/racket/stxparam-exptime.rkt
 
 
 Any suggestions?
 
 Thanks!
 
 --- nadeem
 _
   Racket Developers list:
   http://lists.racket-lang.org/dev
_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] Sandbox evaluation problem - files with comment boxes

2015-01-27 Thread Nadeem Abdul Hamid
Ok, thank you! I can use the latest build.
--- nadeem

On Tuesday, January 27, 2015, Matthew Flatt mfl...@cs.utah.edu wrote:

 Yes, it's a bug in v6.1.1. I've just pushed a repair for the next
 build.

 Do you need a workaround for v6.1.1? Your variant that sets
 `sandbox-namespace-specs` is what I would have tried; unfortunately,
 that runs into a second bug in v6.1.1 that I recently fixed. If you
 need a workaround other than using the next snapshot, I can look harder
 for one.

 Thanks for the report!

 At Mon, 26 Jan 2015 21:27:31 -0500, Nadeem Abdul Hamid wrote:
  Ah, I am still struggling with this sandbox problem! (previous message to
  'users' below) I'm starting to feel like maybe there's a bug in 6.1.1, or
  else something changed in recent versions that I'm missing. The following
  screenshots show the entire contents of the BSL file that I'm trying to
  load using make-module-evaluator, with gracket v6.1.1 failing the second
  time you try to load the file (or another one) that contains a comment
 box,
  while racket v6.1.1 and gracket 6.0 don't have this behavior:
 
  http://cs.berry.edu/~nhamid/temp/foo.png
  http://cs.berry.edu/~nhamid/temp/foo60.png
 
  ???
 
  --- nadeem
 
 
 
  -- Forwarded message --
  From: Nadeem Abdul Hamid nad...@acm.org javascript:;
  Date: Sun, Jan 25, 2015 at 10:35 PM
  Subject: Sandbox evaluation problem - files with comment boxes
  To: users us...@racket-lang.org javascript:;
 
 
 
  I'm trying to create a simple sandbox evaluator (to load in programs in
  *SL). I have the following code:
 
  #lang racket
  (require racket/sandbox)
  (define E
(parameterize ([sandbox-path-permissions
'([write /var/folders]
  [exists /]
  [read /])]
   )
  (make-module-evaluator (string-path test-file.rkt
 
 
  This works fine as long as test-file.rkt does *not* contain a comment
 box.
  If the file contains a comment box, then the following error occurs:
 
  /Applications/Racket
  v6.1.1/share/pkgs/snip-lib/racket/snip/private/load-one.rkt:21:2:
  dynamic-require: unknown module
module name: #resolved-module-path:/Applications/Racket
  v6.1.1/share/pkgs/gui-lib/framework/main.rkt
 
 
 
  I thought maybe parameterizing sandbox-namespace-specs with 'framework
  might do something:
 
  (require racket/sandbox racket/gui)
  (define E
(parameterize ([sandbox-path-permissions
'([write /var/folders]
  [exists /]
  [read /])]
   [sandbox-namespace-specs
(list make-gui-namespace 'framework)]
   )
  (make-module-evaluator (string-path lab01-insulin.rkt
 
  But it results in:
 namespace-attach-module: a different instance of the same module is
  already in the destination namespace
module name: /Applications/Racket
  v6.1.1/collects/racket/stxparam-exptime.rkt
 
 
  Any suggestions?
 
  Thanks!
 
  --- nadeem
  _
Racket Developers list:
http://lists.racket-lang.org/dev



-- 

--
Nadeem Abdul Hamid
Associate Professor, Computer Science
Berry College, Mount Berry, GA 30149
http://cs.berry.edu/~nhamid/
_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] Release process for split repos

2015-01-27 Thread Vincent St-Amour
That sounds good to me.

One concern, though: it looks like recreating old releases requires that
all the participating repos (1) still exist, (2) have the same
name/location, and (3) still have the release tags. I'm not too worried
about (1) and (3), but I could see (2) happening if, e.g., a package
changes maintainer (and therefore location), or if we have to move away
from github at some point.

IIUC, archiving snapshots of the participating repos when the release is
finalized may solve that problem. Does that sound reasonable?

Vincent



At Fri, 23 Jan 2015 15:31:21 -0500,
Ryan Culpepper wrote:
 
 I’ve added a draft of a new release process that takes the repository split 
 into account. The main difference is that there is no longer a single release 
 branch under central management; instead, there is a release branch for each 
 repository, and management responsibilities for package release branches is 
 distributed.
 
 The wiki page is here:
 
   https://github.com/plt/racket/wiki/Release-process
 
 Please review, ask questions, and point out ambiguities and potential 
 problems.
 
 Ryan
 
 
 _
   Racket Developers list:
   http://lists.racket-lang.org/dev

_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] Release process for split repos

2015-01-26 Thread Neil Toronto
I like the general idea. I especially like that you've included 
instructions for repo managers like me who will likely forget everything 
about git branch management and cherry picking between releases.


In the past, you've played the part of central reviewer for requests to 
merge to the release branch. Are we going to try for the same kind of 
consistency now, or leave it up to repo managers?


Neil ⊥

On 01/23/2015 03:31 PM, Ryan Culpepper wrote:

I’ve added a draft of a new release process that takes the repository split 
into account. The main difference is that there is no longer a single release 
branch under central management; instead, there is a release branch for each 
repository, and management responsibilities for package release branches is 
distributed.

The wiki page is here:

   https://github.com/plt/racket/wiki/Release-process

Please review, ask questions, and point out ambiguities and potential problems.

Ryan


_
   Racket Developers list:
   http://lists.racket-lang.org/dev


_
 Racket Developers list:
 http://lists.racket-lang.org/dev


Re: [racket-dev] In Typed Racket, struct declarations do not work in an internal definition context

2015-01-24 Thread Alexis King
Yes, I’d considered that point, and yes, it makes sense. Anyway, the situation 
in which I was trying to do something like this ended up being unnecessary, so 
I don’t even have a valid use-case anymore. I think it’s probably okay to leave 
it as-is unless someone can come up with a useful reason to care.

 On Jan 24, 2015, at 09:24, Sam Tobin-Hochstadt sa...@cs.indiana.edu wrote:
 
 On Thu, Jan 22, 2015 at 3:57 PM, Alexis King lexi.lam...@gmail.com wrote:
 
 I can work around this in a variety of ways—I can extract this into an
 untyped module and use require/typed, I can use vectors to “fake” structs
 and provide an appropriate interface, etc. Still, I wonder if there are any
 plans to resolve this type of problem? Since it seems to be an issue with
 how TR handles types at its core, I’m not even sure how feasible it would
 be.
 
 
 I don't currently have plans to work on this problem. The big issue is
 that Racket structs are what's called generative, meaning that each
 time you execute a struct declaration, you get a different struct
 type. Thus it's not at all clear what the right type should be for
 your `make-me-a-struct` function, and type systems that do allow this
 sort of thing (such as ML) would reject this particular use.
 
 Can you say more about the specific issue you're having? There might
 be a different way around it.
 
 Sam


_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] In Typed Racket, struct declarations do not work in an internal definition context

2015-01-24 Thread Alexis King
I haven’t dug deep enough into the TR code to know for sure, but I think the 
difference is that structs declare fundamentally new types, whereas inline type 
definitions only declare type aliases. Whether or not this is actually the 
problem is unclear—I don’t know TR well enough to answer that.

 On Jan 23, 2015, at 21:23, Alexander D. Knauth alexan...@knauth.org wrote:
 
 There’s a bug report about this here:
 http://bugs.racket-lang.org/query/?cmd=viewpr=14524 
 http://bugs.racket-lang.org/query/?cmd=viewpr=14524
 Though I notice it gives a different error message now.
 But why should structure type declarations being a module-wide construct?
 Internal function definitions work, and internal type definitions work, so 
 why shouldn’t internal structure definitions?
 
 
 On Jan 22, 2015, at 3:57 PM, Alexis King lexi.lam...@gmail.com 
 mailto:lexi.lam...@gmail.com wrote:
 
 Simple enough. This works:
 
 #lang racket
 
 (define (make-me-a-struct)
   (struct foo ())
   (foo))
 
 (make-me-a-struct) ; = #foo
 
 This does not:
 
 #lang typed/racket
 
 (define (make-me-a-struct)
   (struct foo ())
   (foo)) ; error: cannot apply a function with unknown arity
 
 (make-me-a-struct)
 
 This problem makes sense. Type declarations seem to be a module-wide 
 construct, so a type that should be scoped to a single function doesn’t 
 work. I’m running into this issue when trying to create an executable struct 
 using define-struct/exec from within a macro, which doesn’t work due to this 
 particular problem.
 
 I can work around this in a variety of ways—I can extract this into an 
 untyped module and use require/typed, I can use vectors to “fake” structs 
 and provide an appropriate interface, etc. Still, I wonder if there are any 
 plans to resolve this type of problem? Since it seems to be an issue with 
 how TR handles types at its core, I’m not even sure how feasible it would be.
 _
  Racket Developers list:
  http://lists.racket-lang.org/dev http://lists.racket-lang.org/dev
 

_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] In Typed Racket, struct declarations do not work in an internal definition context

2015-01-24 Thread Sam Tobin-Hochstadt
On Thu, Jan 22, 2015 at 3:57 PM, Alexis King lexi.lam...@gmail.com wrote:

 I can work around this in a variety of ways—I can extract this into an
 untyped module and use require/typed, I can use vectors to “fake” structs
 and provide an appropriate interface, etc. Still, I wonder if there are any
 plans to resolve this type of problem? Since it seems to be an issue with
 how TR handles types at its core, I’m not even sure how feasible it would
 be.


I don't currently have plans to work on this problem. The big issue is
that Racket structs are what's called generative, meaning that each
time you execute a struct declaration, you get a different struct
type. Thus it's not at all clear what the right type should be for
your `make-me-a-struct` function, and type systems that do allow this
sort of thing (such as ML) would reject this particular use.

Can you say more about the specific issue you're having? There might
be a different way around it.

Sam

_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] In Typed Racket, struct declarations do not work in an internal definition context

2015-01-23 Thread Alexander D. Knauth
There’s a bug report about this here:
http://bugs.racket-lang.org/query/?cmd=viewpr=14524
Though I notice it gives a different error message now.
But why should structure type declarations being a module-wide construct?
Internal function definitions work, and internal type definitions work, so why 
shouldn’t internal structure definitions?


On Jan 22, 2015, at 3:57 PM, Alexis King lexi.lam...@gmail.com wrote:

 Simple enough. This works:
 
 #lang racket
 
 (define (make-me-a-struct)
   (struct foo ())
   (foo))
 
 (make-me-a-struct) ; = #foo
 
 This does not:
 
 #lang typed/racket
 
 (define (make-me-a-struct)
   (struct foo ())
   (foo)) ; error: cannot apply a function with unknown arity
 
 (make-me-a-struct)
 
 This problem makes sense. Type declarations seem to be a module-wide 
 construct, so a type that should be scoped to a single function doesn’t work. 
 I’m running into this issue when trying to create an executable struct using 
 define-struct/exec from within a macro, which doesn’t work due to this 
 particular problem.
 
 I can work around this in a variety of ways—I can extract this into an 
 untyped module and use require/typed, I can use vectors to “fake” structs and 
 provide an appropriate interface, etc. Still, I wonder if there are any plans 
 to resolve this type of problem? Since it seems to be an issue with how TR 
 handles types at its core, I’m not even sure how feasible it would be.
 _
  Racket Developers list:
  http://lists.racket-lang.org/dev

_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] (reposted from users) Noisy compiler at PLTSTDERR=info

2015-01-22 Thread Matthew Flatt
At Wed, 21 Jan 2015 11:22:38 -0500, Tony Garnock-Jones wrote:
 Over the past few months, more and more subsystems have started logging
 at info level as part of regular compilation.
 
 I prefer having PLTSTDERR=info in order to catch log-info that happens
 at runtime, and find the compile-time log output quite distracting.
 
 My current workaround is to set
 
 PLTSTDERR=info warning@cm warning@compiler/cm warning@module-prefetch
 warning@setup/parallel-build warning@cm-accomplice
 warning@online-check-syntax
 
 but this is quite verbose, and as subsystem log messages come and go
 I'll need to keep updating it.
 
 Could one of the following ideas be worth exploring?
 
  1. Have a superlogger for these (and other?) compile-time-ish loggers,
 so that I could write info warning@compilation, excluding the
 noise in one fell swoop
 
  2. Have a phase number associated with logging, so I could say
 info@0 warning@1, or similar

I have a suggestion below, but it's based on a guess of what you really
want, and it might be a bad guess.


Here's my train of thought:

On 1 above: I've been uncertain of the best way to organize logging
from the start, but the idea of grouping topics hierarchically (such as
a compilation topic group) doesn't sound promising. The original
implementation had a notion of hierarchy that I thought might play out
this way, but it didn't. Overall, it seems to be difficult to fit
topics into a hierarchy a priori, in much the same way that it has been
difficult or awkward to group exceptions hierarchically (and few Racket
libraries attempt to extend the exception hierarchy). I guess there's
often a mismatch between the producer's original idea of organization
the and consumer's eventual idea.

On 2 above: I'm not sure why compilation or phase 1 is special. As more
and more libraries use logging, it seems like they will generate noise
(from your perspective) at run time, too.


More generally:

The most successful step in the logging system's evolution was the move
toward level@topic specifications that include specific topics
of interest. In a growing sea of information, knowing which pieces you
want and specifying those pieces makes sense. Trying to exclude a
category of information is much harder, because it's hard to know all
the information that will be available to exclude.

At the same time, it makes sense to have error messages visible all
the time for all topics, because users should see errors that they
didn't anticipate. Similarly, it makes sense for a user to request
extra unanticipated information at the warning level.

In this sense, the info label is ambiguous. The info level could be
like warning: information that a human consumer might be interested
in without anticipating it, but (unlike warning) not a suggestion of
a problem. Or info could be more like debug: details that are only
useful when you're looking closely at a specific subsystem. A potential
distinction between info and debug is that the former makes sense
to the consumer of the subsystem as opposed to the producer.

My only idea, then, is that we're missing a level somewhere between
debug and warning. My guess is that you're getting too much
information from info, because you wanted a human-volume level of
status information; sometimes info is used for that. Other uses of
info are more like debug --- not really human-volume --- and that's
the part you don't want to see. It happens that many of the current
debug-like uses of info are in compilation subsystems.

If I'm guessing right, then we could introduce a new level and sort out
existing uses:

 * fatal - last-ditch communication channel before termination
 * error - errors
 * warning - info for humans that alerts a potential mistake
 * info - info for humans on status and progress
 * detail - info for subsystem consumers, not necessarily human-volume
 * debug - info for subsystem implementers, not necessarily human-volume

The idea is that most of the compilation messages could move to
detail. (Or maybe it makes sense to add the level between info and
warning; it becomes a transition and compatibility question as much
as anything.)

In retrospect, I realize that I've often struggled with choosing info
vs. debug levels precisely because I haven't been clear on which is
meant as human-volume --- or even that it makes sense to consider a
human-volume vs. machine-volume distinction. Other times, I've
struggled with info vs. debug because of a internal vs. external
distinction.


Does any of that connect to your actual situation and goals?

_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] Full transparency

2015-01-22 Thread Matthew Flatt
I don't think you want to do anything with the compiler or macros.
Instead, it's a matter of having a sufficiently powerful inspector
(which is the concept of inspectability turned into a language
construct).

If you have just

 (struct a (x))
 (a 1)

then the result will print as `#a`. But if you use

 (define orig-i (current-inspector))
 (define sub-i (make-inspector orig-i))

 (current-inspector sub-i)
 (struct a (x))
 (define v (a 1))
 (current-inspector orig-i)

 v

Then, the result will print as `(a 1)`. That's because the structure
declaration is creates under an inspector `sub-i` (which is the current
inspector at the time) that is subordinate to the inspector `orig-i`
that is in place when the structure instance is printed.

The current inspector is determined dynamically, which means that if
you're loading some code, you can set the inspector while loading the
code. For example, if a.rkt is

 #lang racket/base
 (provide v)

 (struct a (x))
 (define v (a 1))

then

 (define v
   (parameterize ([current-inspector (make-inspector)])
 (dynamic-require a.rkt 'v)))
 v

will print the `a` instance transparently.


To protect libraries, there's no safe way to access a root inspector
that controls all structure types when you start Racket. Nothing is
safe from unsafe code, though, and here's an unsafe way to access the
root inspector:

 #lang racket/base
 (require ffi/unsafe)

 (define-cstruct _Scheme_Inspector
   ([stag _short]
[keyex _short]
[depth _int]
[superior _racket]))

 (define root-inspector
   (Scheme_Inspector-superior
((get-ffi-obj 'scheme_get_initial_inspector
  #f
  (_fun - (_gcable _Scheme_Inspector-pointer))

Using `root-inspector`, you can inspect any structure instance.

At Wed, 21 Jan 2015 23:46:10 -0700, Byron Davies wrote:
 Nice parry!  What may be straightforward to you may not be so obvious to
 me.  But I'll take a look.
 
 I'm deep into a project using Racket for weakest precondition analysis.
 Every time I'm debugging it seems like I have to write another
 special-purpose accessor, or export some existing accessor up through
 multiple levels in order to get at the data I need at the top-level.  I
 remember how easy it was with the Lisp Machine to navigate through data no
 matter what it was.
 
 The Lisp Machine offered total transparency, with no real way to protect
 data, to the benefit of the developer.  Racket offers total opacity, to the
 benefit of code security.  I'm hoping there's a middle ground, where
 transparency can be turned on and off.
 
 Byron
 
 On Wed, Jan 21, 2015 at 12:20 PM, Matthias Felleisen matth...@ccs.neu.edu
 wrote:
 
 
  Sounds like a straightforward change to the existing macros. Why don't you
  create a fork and experiment?
 
 
  On Jan 21, 2015, at 1:15 PM, Byron Davies byrondav...@starshine.us
  wrote:
 
   Or, more conservatively, every struct and object in a given package,
  file, or set of files.
  
   On Wed, Jan 21, 2015 at 11:03 AM, Byron Davies byrondav...@starshine.us
  wrote:
   Would it be easy to create a compiler flag that would make every struct
  and object transparent?  This would then make it easy to create a Lisp
  Machine-style Inspector that would be able to roam through every data
  structure during debugging.
  
   Byron
  
  
   _
Racket Developers list:
http://lists.racket-lang.org/dev
 
 
 _
   Racket Developers list:
   http://lists.racket-lang.org/dev
_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] (reposted from users) Noisy compiler at PLTSTDERR=info

2015-01-22 Thread Tony Garnock-Jones
Hi Matthew,

Thanks for those thoughts.

On 01/22/2015 09:11 AM, Matthew Flatt wrote:
 On 1 above: I've been uncertain of the best way to organize logging
 from the start, but the idea of grouping topics hierarchically (such as
 a compilation topic group) doesn't sound promising.

I agree. Better perhaps would be a more relational approach. There are
all sorts of cross-cutting ways one might like to filter log messages:

 - by package author (all the messages in code I wrote)
 - by package
 - by collection
 - by module
 - by specific subroutine?
 - by level (debug, info, warning etc)
 - by phase
 - by place
 - by predicate (e.g. regexp) on log message or log datum

I don't know how to do this yet. Certainly not with the efficiency of
the current logging system!

 I guess there's
 often a mismatch between the producer's original idea of organization
 the and consumer's eventual idea.

Yes, that's a very good point.

 On 2 above: I'm not sure why compilation or phase 1 is special. As more
 and more libraries use logging, it seems like they will generate noise
 (from your perspective) at run time, too.

On reflection, I agree with you. Phase is just one of the many axes
listed above.

 In this sense, the info label is ambiguous. [...]
 My only idea, then, is that we're missing a level somewhere between
 debug and warning.

To me it feels like there is one major divison when it comes to levels:
that between errors/warnings and informational messages. Within each
grouping, less important subdivisions exist.

If I can turn on and off the informational messages as a group, for
individual *subsystems*, I think I'm happy.

So my current workaround works OK for me. Adding an extra gradation
between info and debug wouldn't add much in this example.

I think I'm after finer control of selecting messages on axes *other*
than level/severity.

-- Tony

_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] Full transparency

2015-01-21 Thread Byron Davies
Or, more conservatively, every struct and object in a given package, file,
or set of files.

On Wed, Jan 21, 2015 at 11:03 AM, Byron Davies byrondav...@starshine.us
wrote:

 Would it be easy to create a compiler flag that would make every struct
 and object transparent?  This would then make it easy to create a Lisp
 Machine-style Inspector that would be able to roam through every data
 structure during debugging.

 Byron


_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] Full transparency

2015-01-21 Thread Matthias Felleisen

Sounds like a straightforward change to the existing macros. Why don't you 
create a fork and experiment? 


On Jan 21, 2015, at 1:15 PM, Byron Davies byrondav...@starshine.us wrote:

 Or, more conservatively, every struct and object in a given package, file, or 
 set of files.
 
 On Wed, Jan 21, 2015 at 11:03 AM, Byron Davies byrondav...@starshine.us 
 wrote:
 Would it be easy to create a compiler flag that would make every struct and 
 object transparent?  This would then make it easy to create a Lisp 
 Machine-style Inspector that would be able to roam through every data 
 structure during debugging.
 
 Byron
 
 
 _
  Racket Developers list:
  http://lists.racket-lang.org/dev


_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] Full transparency

2015-01-21 Thread Byron Davies
Nice parry!  What may be straightforward to you may not be so obvious to
me.  But I'll take a look.

I'm deep into a project using Racket for weakest precondition analysis.
Every time I'm debugging it seems like I have to write another
special-purpose accessor, or export some existing accessor up through
multiple levels in order to get at the data I need at the top-level.  I
remember how easy it was with the Lisp Machine to navigate through data no
matter what it was.

The Lisp Machine offered total transparency, with no real way to protect
data, to the benefit of the developer.  Racket offers total opacity, to the
benefit of code security.  I'm hoping there's a middle ground, where
transparency can be turned on and off.

Byron

On Wed, Jan 21, 2015 at 12:20 PM, Matthias Felleisen matth...@ccs.neu.edu
wrote:


 Sounds like a straightforward change to the existing macros. Why don't you
 create a fork and experiment?


 On Jan 21, 2015, at 1:15 PM, Byron Davies byrondav...@starshine.us
 wrote:

  Or, more conservatively, every struct and object in a given package,
 file, or set of files.
 
  On Wed, Jan 21, 2015 at 11:03 AM, Byron Davies byrondav...@starshine.us
 wrote:
  Would it be easy to create a compiler flag that would make every struct
 and object transparent?  This would then make it easy to create a Lisp
 Machine-style Inspector that would be able to roam through every data
 structure during debugging.
 
  Byron
 
 
  _
   Racket Developers list:
   http://lists.racket-lang.org/dev


_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] Compiling a Debuggable Windows Build

2015-01-20 Thread Matthew Flatt
We don't have build products handy on a server, but it shouldn't be
difficult to build yourself using Visual Studio 10. I recommend setting
up the command line using vcvarsall.bat x86_amd64, and then build
from the Git repo using nmake win32-in-place.

That process will give you debugging information in .pdb files, at
least for Racket. It will still build with optimization (so detailed
debugging wouldn't be fun), and there won't be debugging information
for the pre-built graphics and GUI libraries. It might be enough
information to help pinpoint the problem, though.

At Tue, 20 Jan 2015 10:25:04 +0100, Christian Eitner wrote:
 Hello everyone,
 
 I'm trying to analyze bug 14927, which simply states that I cannot
 save any kind of definitions file from DrRacket on Win7 64. The
 message is Racket GUI application has stopped working, i.e., the
 windows crash dialog.
 
 I'm pretty sure the problem is related to my machine only, since on a
 colleague's PC everything works fine.
 
 So I need a Windows build which I can debug. Is there something on the
 build servers which I could use?
 
 I could build locally, having both a Visual Studio (10, 12, 13) and a
 Cygwin 64 environment, or even cross-compile on Ubuntu if that was
 easier/possible.
 
 BTW, how are the provided Windows builds being generated?
 
 Any hints would be welcome.
 
 Thanks for your consideration,
 
 Christian
 _
   Racket Developers list:
   http://lists.racket-lang.org/dev
_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] Compiling a Debuggable Windows Build

2015-01-20 Thread Christian Eitner
Thanks, that should put me on the right track...

The build currently fails because raco is not aware of our mandatory
http proxy, but that is another topic.

Cheers,

Christian

On 20 January 2015 at 15:03, Matthew Flatt mfl...@cs.utah.edu wrote:
 We don't have build products handy on a server, but it shouldn't be
 difficult to build yourself using Visual Studio 10. I recommend setting
 up the command line using vcvarsall.bat x86_amd64, and then build
 from the Git repo using nmake win32-in-place.

 That process will give you debugging information in .pdb files, at
 least for Racket. It will still build with optimization (so detailed
 debugging wouldn't be fun), and there won't be debugging information
 for the pre-built graphics and GUI libraries. It might be enough
 information to help pinpoint the problem, though.

 At Tue, 20 Jan 2015 10:25:04 +0100, Christian Eitner wrote:
 Hello everyone,

 I'm trying to analyze bug 14927, which simply states that I cannot
 save any kind of definitions file from DrRacket on Win7 64. The
 message is Racket GUI application has stopped working, i.e., the
 windows crash dialog.

 I'm pretty sure the problem is related to my machine only, since on a
 colleague's PC everything works fine.

 So I need a Windows build which I can debug. Is there something on the
 build servers which I could use?

 I could build locally, having both a Visual Studio (10, 12, 13) and a
 Cygwin 64 environment, or even cross-compile on Ubuntu if that was
 easier/possible.

 BTW, how are the provided Windows builds being generated?

 Any hints would be welcome.

 Thanks for your consideration,

 Christian
 _
   Racket Developers list:
   http://lists.racket-lang.org/dev
_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] [racket] Implementing contracts for async channels

2015-01-19 Thread Robby Findler
Oh, sorry I missed that.

Robby

On Mon, Jan 19, 2015 at 6:40 PM, Alexis King lexi.lam...@gmail.com wrote:
 I already used blame-add-context, but the message I used wasn’t very good, so 
 I’ve improved it. If everything else looks good, feel free to merge this 
 whenever you get the chance!

 On Jan 19, 2015, at 15:52, Robby Findler ro...@eecs.northwestern.edu wrote:

 Ah: one other note. When you do something like this:

 ((contract (- (list/c (box/c integer?)) any)
   (λ (x) (unbox (car x)))
   'pos 'neg)
 (list (box not an integer)))

 you get an error message that has this text in the middle:

  in: the content of
  the 1st element of
  the 1st argument of
  (- (list/c (box/c integer?)) any)

 This path information is collected in the blame records.

 So, instead of passing along just the blame record you got, call
 blame-add-context so you get some stuff in that portion of the error
 message.

 Maybe a value passed on or something like that would be a good
 phrase? I usually look at a few examples to pick something.

 Otherwise, this looks good to merge to me (but I don't use the
 generics as much as I should so if you wanted to you could try asking
 for someone specifically knowledgeable to look there).

 If you don't, I can push the commit to the appropriate repo. Let me know.

 Robby



 On Mon, Jan 19, 2015 at 5:44 PM, Alexis King lexi.lam...@gmail.com wrote:
 Yes, there are tests, and you can see them here.

 On Jan 19, 2015, at 13:29, Robby Findler ro...@eecs.northwestern.edu
 wrote:

 This seemed okay, but just a quick read of the code. But did I miss
 the test cases? (I just followed the link upthread -- sorry if I need
 to look somewhere else too.)

 Robby


 On Mon, Jan 19, 2015 at 3:15 PM, Alexis King lexi.lam...@gmail.com wrote:

 Any update on this? If there’s anything that still needs to be changed, let
 me know—otherwise, I’ll patiently wait for the process to run its course.
 Just checking in.

 On Jan 16, 2015, at 10:15, Alexis King lexi.lam...@gmail.com wrote:

 Ah, that makes sense, fixed.

 On Jan 16, 2015, at 05:37, Robby Findler ro...@eecs.northwestern.edu
 wrote:

 One comment. The contract combinators are curried so that you can do
 work on the partial applications. So don't write this:

 (define ho-val-first-projection
 impersonate/chaperone-async-channel) ctc) blame) val)

 instead try to do some work earlier, when you first can. (The most
 important thing is to minimize the work done after you get the 'val'
 argument.)

 Robby




 _
 Racket Developers list:
 http://lists.racket-lang.org/dev




_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] [racket] Implementing contracts for async channels

2015-01-19 Thread Alexis King
Yes, there are tests, and you can see them here 
https://github.com/plt/racket/pull/860/files#diff-9383600c097f090324382317068c6187R1.

 On Jan 19, 2015, at 13:29, Robby Findler ro...@eecs.northwestern.edu wrote:
 
 This seemed okay, but just a quick read of the code. But did I miss
 the test cases? (I just followed the link upthread -- sorry if I need
 to look somewhere else too.)
 
 Robby
 
 
 On Mon, Jan 19, 2015 at 3:15 PM, Alexis King lexi.lam...@gmail.com wrote:
 Any update on this? If there’s anything that still needs to be changed, let 
 me know—otherwise, I’ll patiently wait for the process to run its course. 
 Just checking in.
 
 On Jan 16, 2015, at 10:15, Alexis King lexi.lam...@gmail.com wrote:
 
 Ah, that makes sense, fixed.
 
 On Jan 16, 2015, at 05:37, Robby Findler ro...@eecs.northwestern.edu 
 wrote:
 
 One comment. The contract combinators are curried so that you can do
 work on the partial applications. So don't write this:
 
 (define ho-val-first-projection
 impersonate/chaperone-async-channel) ctc) blame) val)
 
 instead try to do some work earlier, when you first can. (The most
 important thing is to minimize the work done after you get the 'val'
 argument.)
 
 Robby
 
 
 
 _
  Racket Developers list:
  http://lists.racket-lang.org/dev

_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] [racket] Implementing contracts for async channels

2015-01-19 Thread Alexis King
Any update on this? If there’s anything that still needs to be changed, let me 
know—otherwise, I’ll patiently wait for the process to run its course. Just 
checking in.

 On Jan 16, 2015, at 10:15, Alexis King lexi.lam...@gmail.com wrote:
 
 Ah, that makes sense, fixed.
 
 On Jan 16, 2015, at 05:37, Robby Findler ro...@eecs.northwestern.edu wrote:
 
 One comment. The contract combinators are curried so that you can do
 work on the partial applications. So don't write this:
 
 (define ho-val-first-projection
 impersonate/chaperone-async-channel) ctc) blame) val)
 
 instead try to do some work earlier, when you first can. (The most
 important thing is to minimize the work done after you get the 'val'
 argument.)
 
 Robby
 


_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] [racket] Implementing contracts for async channels

2015-01-19 Thread Robby Findler
This seemed okay, but just a quick read of the code. But did I miss
the test cases? (I just followed the link upthread -- sorry if I need
to look somewhere else too.)

Robby


On Mon, Jan 19, 2015 at 3:15 PM, Alexis King lexi.lam...@gmail.com wrote:
 Any update on this? If there’s anything that still needs to be changed, let 
 me know—otherwise, I’ll patiently wait for the process to run its course. 
 Just checking in.

 On Jan 16, 2015, at 10:15, Alexis King lexi.lam...@gmail.com wrote:

 Ah, that makes sense, fixed.

 On Jan 16, 2015, at 05:37, Robby Findler ro...@eecs.northwestern.edu 
 wrote:

 One comment. The contract combinators are curried so that you can do
 work on the partial applications. So don't write this:

 (define ho-val-first-projection
 impersonate/chaperone-async-channel) ctc) blame) val)

 instead try to do some work earlier, when you first can. (The most
 important thing is to minimize the work done after you get the 'val'
 argument.)

 Robby



 _
   Racket Developers list:
   http://lists.racket-lang.org/dev

_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] Announcing Soft Contract Verification tool

2015-01-18 Thread Benjamin Greenman
On Sun, Jan 18, 2015 at 9:44 AM, Greg Hendershott greghendersh...@gmail.com
 wrote:

 Is there a similarly simple/standard way to disable contracts?


I'd love a #lang like that. Never mind Tony Hoare's metaphor about sailing.
For now, I'm attaching a small patch that'll disable contracts (as far as I
can tell) on the current build; it's adapted from Leif's commits at [1].

;; ---

Please keep the bug reports coming!


It looks like the built-in function expt isn't defined correctly:

(module f racket
  (provide (contract-out [f (integer? . - . integer?)]))
  (define (f n)
(expt n n)))

Contract violation: 'f' violates 'expt'.
Wrong arity
An example module that breaks it:
  (module user racket (require (submid .. f)) (f 0))

  (verification takes 0.035s)

[1] https://github.com/LeifAndersen/racket/tree/no-conracts
From e3a07fa756f47e0eb93be0811f245f1f814f028e Mon Sep 17 00:00:00 2001
From: ben ty...@ccs.neu.edu
Date: Sun, 18 Jan 2015 18:51:48 -0500
Subject: [PATCH] imported leif's no-contract changes

---
 racket/collects/racket/contract/private/base.rkt   |  7 +-
 .../collects/racket/contract/private/provide.rkt   | 80 +++---
 2 files changed, 43 insertions(+), 44 deletions(-)

diff --git a/racket/collects/racket/contract/private/base.rkt b/racket/collects/racket/contract/private/base.rkt
index c7bb61c..cf0ca33 100644
--- a/racket/collects/racket/contract/private/base.rkt
+++ b/racket/collects/racket/contract/private/base.rkt
@@ -35,13 +35,10 @@
 (define-syntax (contract stx)
   (syntax-case stx ()
 [(_ c v pos neg name loc)
- (syntax/loc stx
-   (apply-contract c v pos neg name loc))]
+ (syntax/loc stx v)]
 [(_ c v pos neg)
  (with-syntax ([name (syntax-local-infer-name stx)])
-  (syntax/loc stx
-(apply-contract c v pos neg 'name
-(build-source-location #f]
+  (syntax/loc stx v))]
 [(_ c v pos neg src)
  (raise-syntax-error 'contract
(string-append
diff --git a/racket/collects/racket/contract/private/provide.rkt b/racket/collects/racket/contract/private/provide.rkt
index 5356a64..b020493 100644
--- a/racket/collects/racket/contract/private/provide.rkt
+++ b/racket/collects/racket/contract/private/provide.rkt
@@ -350,42 +350,44 @@
 (raise-syntax-error #f expected an identifier stx #'new-id))
   (unless (identifier? #'orig-id)
 (raise-syntax-error #f expected an identifier stx #'orig-id))
-  (define-values (pos-blame-party-expr srcloc-expr)
-(let loop ([kwd-args (syntax-list #'(kwd-args ...))]
-   [pos-blame-party-expr #'(quote-module-path)]
-   [srcloc-expr #f])
-  (cond
-[(null? kwd-args) (values pos-blame-party-expr
-  (or srcloc-expr (stx-srcloc-expr stx)))]
-[else
- (define kwd (car kwd-args))
- (cond 
-   [(equal? (syntax-e kwd) '#:pos-source)
-(when (null? (cdr kwd-args))
-  (raise-syntax-error #f expected a keyword argument to follow #:pos-source
-  stx))
-(loop (cddr kwd-args)
-  (cadr kwd-args)
-  srcloc-expr)]
-   [(equal? (syntax-e kwd) '#:srcloc)
-(when (null? (cdr kwd-args))
-  (raise-syntax-error #f expected a keyword argument to follow #:srcloc
-  stx))
-(loop (cddr kwd-args)
-  pos-blame-party-expr
-  (cadr kwd-args))]
-   [else
-(raise-syntax-error #f expected either the keyword #:pos-source of #:srcloc
-stx
-(car kwd-args))])])))
-  (internal-function-to-be-figured-out #'ctrct
-   #'orig-id
-   #'orig-id
-   #'new-id
-   #'new-id
-   srcloc-expr
-   'define-module-boundary-contract
-   pos-blame-party-expr))])]))
+  (define new-id orig-id)
+  ;; (define-values (pos-blame-party-expr srcloc-expr)
+  ;;   (let loop ([kwd-args (syntax-list #'(kwd-args ...))]
+  ;;  [pos-blame-party-expr #'(quote-module-path)]
+  ;;  [srcloc-expr #f])
+  ;; (cond
+  ;;   [(null? kwd-args) (values pos-blame-party-expr
+  ;; (or srcloc-expr (stx-srcloc-expr stx)))]
+  ;;   [else
+  ;;(define kwd (car 

Re: [racket-dev] Announcing Soft Contract Verification tool

2015-01-18 Thread Greg Hendershott
This looks really exciting!

Imagining using this reminds me of something.

Typed Racket has a simple/standard way to disable type-checking (while
retaining the type declarations for documentation value as well as
potential re-enabling): #lang typed/racket/no-check and #lang
typed/racket/base/no-check.

Is there a similarly simple/standard way to disable contracts?

Last I checked, I couldn't find one. So I think we each write our own
my-define/contract and my-contract-out sort of macros? It's not
difficult. But it's idiosyncratic. Also: tools.

Why not e.g. #lang racket/no-check, and a racket/contract/no-check to
require for use with #lang racket/base?

Although I guess a tool like SCV is more in the business of disabling
individual contracts; not so much whole-file granularity?
_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] Announcing Soft Contract Verification tool

2015-01-16 Thread David Van Horn
On 1/15/15 7:42 PM, Benjamin Greenman wrote:
 I tried writing a small program, but got stuck pretty early on. When I
 try verifying the divides? function below, the tool times out. What's
 happening?
 
 (module div racket
   (provide (contract-out [divides? (- positive? positive? boolean?)]))
 
   (define (positive? x)
 (and (integer? x) (= 0 x)))
   
   (define (divides? a b)
 (cond [(= 0 b) #t]
   [( b a) #f]
   [else (divides? a (- b a))]))
 
 )


There was a bug causing this to loop which has been fixed.  The server
verifies this program now.

Please keep the bug reports coming!

David



_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] Announcing Soft Contract Verification tool

2015-01-16 Thread David Van Horn
On 1/15/15 2:42 PM, David Van Horn wrote:
 On 1/15/15, 2:13 PM, Asumu Takikawa wrote:
 On 2015-01-14 19:11:59 -0500, David Van Horn wrote:
 If you have questions, comments, bugs, or any other feedback, let
 us know, or just file bug reports on the GitHub source code.

 Nice tool! I like the web interface too.

 I was confused by this interaction though. Clicking verify on
 this:

 (module fact racket (define (factorial x) (if (zero? x) 1 (* x
 (factorial (sub1 x) (provide (contract-out [factorial (- (=/c
 0) (=/c 0))])))

 gives me:

 Contract violation: 'fact' violates '='. Value 0.105 violates
 predicate real? An example module that breaks it: (module user
 racket (require (submod .. fact)) (factorial 0.105)) 
 (Verification takes 0.05s)

 but the value 0.105 shouldn't violate the predicate real? I think.
 
 This is reporting that the fact module can break the contract on =
 when it uses =/c; that's a bug in our modelling of =/c, which we
 currently have as:
 
 (define (=/c n)
   (lambda (m)
 (= m n)))
 
 But should be:
 
 (define (=/c n)
   (lambda (m)
 (and (real? m)
  (= m n
 
 That said, if you change it to (and/c real? (=/c 0)), it says there's
 a counterexample of 2.0, but that's because we check contracts on
 recursive calls (and should not).


I misspoke on the issue of boundaries, which we had right, but there
was another bug that's now fixed.  We also fixed the =/c implies
real? bug.

So to summarize, Asumu's program now verifies:

  (module fact racket
(define (factorial x)
  (if (zero? x)
  1
  (* x (factorial (sub1 x)

(provide
  (contract-out
[factorial (- (=/c 0) (=/c 0))])))

A slight variant that uses unsafe contracts will generate
counterexamples causing fact to be blamed:

  (module fact racket
(define (factorial x)
  (if (zero? x)
  1
  (* x (factorial (sub1 x)

(provide
 (contract-out
  [factorial (- (λ (x) (= x 0))
 (λ (x) (= x 0)))])))

The counterexample is:

 (module user racket
   (require (submod .. fact))
   (begin (struct s₃ ()) (factorial (s₃

David


_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] [racket] Implementing contracts for async channels

2015-01-16 Thread Alexis King
Ah, that makes sense, fixed.

 On Jan 16, 2015, at 05:37, Robby Findler ro...@eecs.northwestern.edu wrote:
 
 One comment. The contract combinators are curried so that you can do
 work on the partial applications. So don't write this:
 
 (define ho-val-first-projection
 impersonate/chaperone-async-channel) ctc) blame) val)
 
 instead try to do some work earlier, when you first can. (The most
 important thing is to minimize the work done after you get the 'val'
 argument.)
 
 Robby


_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] Announcing Soft Contract Verification tool

2015-01-15 Thread Matthias Felleisen


On Jan 15, 2015, at 11:13 AM, David Van Horn dvanh...@cs.umd.edu wrote:

 On 1/15/15, 11:04 AM, Matthias Felleisen wrote:
 
 Well that got me all excited. So I tried to get the sample module
 to pass the verification step -- until I realized how restricted
 the grammar is!
 
 (module f racket (provide (contract-out [f (real? . - .
 integer?)])) (define (f n) (/ 1 (- 100 n
 
 I would love to be able to use at least (and/c real? (/c 0)) for
 the domain so I can get the example done.
 
 Or am I overlooking a way to make this work here?
 
 The /c contract is there, but missing from the grammar (we'll fix that).
 
 But (/c 0) will not make this program verify.  You want this contract:
 
 ((and/c real? (lambda (x) (not (= x 100 . - . real?)
 
 Using this contract, the program verifies.


My contract is stronger than yours. So why will it not go through? 
_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] Announcing Soft Contract Verification tool

2015-01-15 Thread David Van Horn
On 1/15/15, 11:27 AM, Matthias Felleisen wrote:
 
 Argh, I wanted the other way (negative). I always get the
 directions confused. Sorry.

Right -- using (and/c real? (/c 0)) will also make this verify.

Thanks for trying it out!

David

 
 
 On Jan 15, 2015, at 11:26 AM, David Van Horn dvanh...@cs.umd.edu
 wrote:
 
 On 1/15/15, 11:17 AM, Matthias Felleisen wrote:
 
 
 On Jan 15, 2015, at 11:13 AM, David Van Horn
 dvanh...@cs.umd.edu wrote:
 
 On 1/15/15, 11:04 AM, Matthias Felleisen wrote:
 
 Well that got me all excited. So I tried to get the sample 
 module to pass the verification step -- until I realized
 how restricted the grammar is!
 
 (module f racket (provide (contract-out [f (real? . - . 
 integer?)])) (define (f n) (/ 1 (- 100 n
 
 I would love to be able to use at least (and/c real? (/c
 0)) for the domain so I can get the example done.
 
 Or am I overlooking a way to make this work here?
 
 The /c contract is there, but missing from the grammar
 (we'll fix that).
 
 But (/c 0) will not make this program verify.  You want
 this contract:
 
 ((and/c real? (lambda (x) (not (= x 100 . - . real?)
 
 Using this contract, the program verifies.
 
 
 My contract is stronger than yours. So why will it not go
 through?
 
 
 
 100 is (/c 0) but (f 100) divides by zero.
 
 David
 

_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] Announcing Soft Contract Verification tool

2015-01-15 Thread Robby Findler
FWIW, (/c 0) already implies real?.

Robby

On Thu, Jan 15, 2015 at 10:30 AM, David Van Horn dvanh...@cs.umd.edu wrote:
 On 1/15/15, 11:27 AM, Matthias Felleisen wrote:

 Argh, I wanted the other way (negative). I always get the
 directions confused. Sorry.

 Right -- using (and/c real? (/c 0)) will also make this verify.

 Thanks for trying it out!

 David



 On Jan 15, 2015, at 11:26 AM, David Van Horn dvanh...@cs.umd.edu
 wrote:

 On 1/15/15, 11:17 AM, Matthias Felleisen wrote:


 On Jan 15, 2015, at 11:13 AM, David Van Horn
 dvanh...@cs.umd.edu wrote:

 On 1/15/15, 11:04 AM, Matthias Felleisen wrote:

 Well that got me all excited. So I tried to get the sample
 module to pass the verification step -- until I realized
 how restricted the grammar is!

 (module f racket (provide (contract-out [f (real? . - .
 integer?)])) (define (f n) (/ 1 (- 100 n

 I would love to be able to use at least (and/c real? (/c
 0)) for the domain so I can get the example done.

 Or am I overlooking a way to make this work here?

 The /c contract is there, but missing from the grammar
 (we'll fix that).

 But (/c 0) will not make this program verify.  You want
 this contract:

 ((and/c real? (lambda (x) (not (= x 100 . - . real?)

 Using this contract, the program verifies.


 My contract is stronger than yours. So why will it not go
 through?



 100 is (/c 0) but (f 100) divides by zero.

 David


 _
   Racket Developers list:
   http://lists.racket-lang.org/dev
_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] Announcing Soft Contract Verification tool

2015-01-15 Thread David Van Horn
On 1/15/15, 11:04 AM, Matthias Felleisen wrote:
 
 Well that got me all excited. So I tried to get the sample module
 to pass the verification step -- until I realized how restricted
 the grammar is!
 
 (module f racket (provide (contract-out [f (real? . - .
 integer?)])) (define (f n) (/ 1 (- 100 n
 
 I would love to be able to use at least (and/c real? (/c 0)) for
 the domain so I can get the example done.
 
 Or am I overlooking a way to make this work here?

The /c contract is there, but missing from the grammar (we'll fix that).

But (/c 0) will not make this program verify.  You want this contract:

((and/c real? (lambda (x) (not (= x 100 . - . real?)

Using this contract, the program verifies.

David

_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] Announcing Soft Contract Verification tool

2015-01-15 Thread David Van Horn
On 1/15/15, 11:17 AM, Matthias Felleisen wrote:
 
 
 On Jan 15, 2015, at 11:13 AM, David Van Horn dvanh...@cs.umd.edu
 wrote:
 
 On 1/15/15, 11:04 AM, Matthias Felleisen wrote:
 
 Well that got me all excited. So I tried to get the sample
 module to pass the verification step -- until I realized how
 restricted the grammar is!
 
 (module f racket (provide (contract-out [f (real? . - . 
 integer?)])) (define (f n) (/ 1 (- 100 n
 
 I would love to be able to use at least (and/c real? (/c 0))
 for the domain so I can get the example done.
 
 Or am I overlooking a way to make this work here?
 
 The /c contract is there, but missing from the grammar (we'll
 fix that).
 
 But (/c 0) will not make this program verify.  You want this
 contract:
 
 ((and/c real? (lambda (x) (not (= x 100 . - . real?)
 
 Using this contract, the program verifies.
 
 
 My contract is stronger than yours. So why will it not go through?
 
 

100 is (/c 0) but (f 100) divides by zero.

David

_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] Announcing Soft Contract Verification tool

2015-01-15 Thread Asumu Takikawa
On 2015-01-15 14:13:02 -0500, Asumu Takikawa wrote:
   Contract violation: 'fact' violates '='.
   Value
 0.105
   violates predicate
 real?
   An example module that breaks it:
 (module user racket (require (submod .. fact)) (factorial 0.105))
   (Verification takes 0.05s)

Hmm, actually I should've looked at this more carefully. Is this a case
where the tool is telling me that the function is non-terminating on
this input?

Cheers,
Asumu
_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] Announcing Soft Contract Verification tool

2015-01-15 Thread Robby Findler
I think this is saying that the result is going to be negative. (But
it won't, since it doesn't terminate.)

Robby


On Thu, Jan 15, 2015 at 1:13 PM, Asumu Takikawa as...@ccs.neu.edu wrote:
 On 2015-01-14 19:11:59 -0500, David Van Horn wrote:
 If you have questions, comments, bugs, or any other feedback, let us
 know, or just file bug reports on the GitHub source code.

 Nice tool! I like the web interface too.

 I was confused by this interaction though. Clicking verify on this:

   (module fact racket
 (define (factorial x)
   (if (zero? x)
   1
   (* x (factorial (sub1 x)
 (provide (contract-out [factorial (- (=/c 0) (=/c 0))])))

 gives me:

   Contract violation: 'fact' violates '='.
   Value
 0.105
   violates predicate
 real?
   An example module that breaks it:
 (module user racket (require (submod .. fact)) (factorial 0.105))
   (Verification takes 0.05s)

 but the value 0.105 shouldn't violate the predicate real? I think.

 Cheers,
 Asumu
 _
   Racket Developers list:
   http://lists.racket-lang.org/dev
_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] Announcing Soft Contract Verification tool

2015-01-15 Thread Asumu Takikawa
On 2015-01-14 19:11:59 -0500, David Van Horn wrote:
 If you have questions, comments, bugs, or any other feedback, let us
 know, or just file bug reports on the GitHub source code.

Nice tool! I like the web interface too.

I was confused by this interaction though. Clicking verify on this:

  (module fact racket
(define (factorial x)
  (if (zero? x)
  1
  (* x (factorial (sub1 x)
(provide (contract-out [factorial (- (=/c 0) (=/c 0))])))

gives me:

  Contract violation: 'fact' violates '='.
  Value
0.105
  violates predicate
real?
  An example module that breaks it:
(module user racket (require (submod .. fact)) (factorial 0.105))
  (Verification takes 0.05s)

but the value 0.105 shouldn't violate the predicate real? I think.

Cheers,
Asumu
_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] Announcing Soft Contract Verification tool

2015-01-15 Thread Robby Findler
Can you randomly make up programs from your grammar, get example
errors from the tool, and then run those programs to see if you find
bugs in the analysis like that one?

That said, I don't see how the bug in =/c is coming in here. Can you
explain more?

Robby


On Thu, Jan 15, 2015 at 1:42 PM, David Van Horn dvanh...@cs.umd.edu wrote:
 On 1/15/15, 2:13 PM, Asumu Takikawa wrote:
 On 2015-01-14 19:11:59 -0500, David Van Horn wrote:
 If you have questions, comments, bugs, or any other feedback, let
 us know, or just file bug reports on the GitHub source code.

 Nice tool! I like the web interface too.

 I was confused by this interaction though. Clicking verify on
 this:

 (module fact racket (define (factorial x) (if (zero? x) 1 (* x
 (factorial (sub1 x) (provide (contract-out [factorial (- (=/c
 0) (=/c 0))])))

 gives me:

 Contract violation: 'fact' violates '='. Value 0.105 violates
 predicate real? An example module that breaks it: (module user
 racket (require (submod .. fact)) (factorial 0.105))
 (Verification takes 0.05s)

 but the value 0.105 shouldn't violate the predicate real? I think.

 This is reporting that the fact module can break the contract on =
 when it uses =/c; that's a bug in our modelling of =/c, which we
 currently have as:

 (define (=/c n)
   (lambda (m)
 (= m n)))

 But should be:

 (define (=/c n)
   (lambda (m)
 (and (real? m)
  (= m n

 That said, if you change it to (and/c real? (=/c 0)), it says there's
 a counterexample of 2.0, but that's because we check contracts on
 recursive calls (and should not).

 Thanks!

 David

 _
   Racket Developers list:
   http://lists.racket-lang.org/dev
_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] Implementing contracts for async channels

2015-01-15 Thread Alexis King
As an update, I’ve made a bit more progress on this. I’ve implemented an 
impersonate-async-channel function, and I’ve actually included this in the 
exports from racket/contract. I also realized the blame information is correct, 
it works fine. Most of the other issues remain, as well as a few new questions:

There is no impersonate-evt function, so I’m not sure that my implementation 
will work. What should I do about this?
I’d assume this needs to be documented/tested as well. Where should those 
things be located?

 On Jan 14, 2015, at 23:44, Alexis King lexi.lam...@gmail.com wrote:
 
 Currently, async channels do not have contracts to check their contents. This 
 is a problem for Typed Racket, and it prevents typed code from interacting 
 with code that produces async channels.
 
 I started looking into how to add contracts to the language, and it seems to 
 use the chaperones/impersonator system, as I suspected. However, async 
 channels obviously cannot be impersonated, so I needed to implement that as 
 well.
 
 I modified the async-channel struct to use generics to allow it to be 
 impersonated or chaperoned, which I have exposed by implementing 
 chaperone-async-channel. I then tried implementing async-channel/c. The 
 internals of the contract system are a little beyond me, but I got a working 
 solution by following the example of the box contracts.
 
 My work thus far can be found here: 
 https://github.com/lexi-lambda/racket/commit/84b9f3604891f3f2061fb28ed4800af8afa4751b
  
 https://github.com/lexi-lambda/racket/commit/84b9f3604891f3f2061fb28ed4800af8afa4751b
 
 First of all, is this a correct approach? Have I done anything wrong, or 
 should I have done anything differently? I didn’t find much documentation on 
 the internals of either of these systems, so I mostly went about things as I 
 found them.
 
 Second, obviously, not everything is implemented here. Among the additional 
 necessary changes are:
 
 I need to implement support for impersonators and impersonator contracts 
 (right now I’ve only bothered to do chaperones).
 I need to implement async-channel/c-first-order and async-channel/c-stronger. 
 I can probably figure out the latter, but I’m not even sure what the former 
 is supposed to do.
 I need to implement a wrap-async-channel/c macro for the export. I’m not sure 
 how this works, either. From looking at wrap-box/c, it seems to add some 
 syntax properties, but I’m not sure what they do or how they work.
 Somehow, the blame information has to be correct. Is that what the wrap 
 function does? Or do the async-channel functions need to be updated to assign 
 blame?
 
 I’d really like to get this working, and I think I’m close, but I’m a little 
 inexperienced. I’d appreciate any help, even if it’s just pointing me in the 
 right direction.
 
 Thanks!

_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] Implementing contracts for async channels

2015-01-15 Thread Alexis King
Sorry, I wasn’t clear. The chaperone/impersonate-async-channel functions are 
exported from racket/async-channel. The async-channel contracts, however, are 
exported from racket/contract.

 On Jan 15, 2015, at 14:41, Robby Findler ro...@eecs.northwestern.edu wrote:
 
 Just a small nit: why export that function from racket/contract and
 not an async-channel library?
 
 Robby
 
 
 On Thu, Jan 15, 2015 at 3:33 PM, Alexis King lexi.lam...@gmail.com wrote:
 As an update, I’ve made a bit more progress on this. I’ve implemented an
 impersonate-async-channel function, and I’ve actually included this in the
 exports from racket/contract. I also realized the blame information is
 correct, it works fine. Most of the other issues remain, as well as a few
 new questions:
 
 There is no impersonate-evt function, so I’m not sure that my implementation
 will work. What should I do about this?
 I’d assume this needs to be documented/tested as well. Where should those
 things be located?
 
 
 On Jan 14, 2015, at 23:44, Alexis King lexi.lam...@gmail.com wrote:
 
 Currently, async channels do not have contracts to check their contents.
 This is a problem for Typed Racket, and it prevents typed code from
 interacting with code that produces async channels.
 
 I started looking into how to add contracts to the language, and it seems to
 use the chaperones/impersonator system, as I suspected. However, async
 channels obviously cannot be impersonated, so I needed to implement that as
 well.
 
 I modified the async-channel struct to use generics to allow it to be
 impersonated or chaperoned, which I have exposed by implementing
 chaperone-async-channel. I then tried implementing async-channel/c. The
 internals of the contract system are a little beyond me, but I got a working
 solution by following the example of the box contracts.
 
 My work thus far can be found here:
 https://github.com/lexi-lambda/racket/commit/84b9f3604891f3f2061fb28ed4800af8afa4751b
 
 First of all, is this a correct approach? Have I done anything wrong, or
 should I have done anything differently? I didn’t find much documentation on
 the internals of either of these systems, so I mostly went about things as I
 found them.
 
 Second, obviously, not everything is implemented here. Among the additional
 necessary changes are:
 
 I need to implement support for impersonators and impersonator contracts
 (right now I’ve only bothered to do chaperones).
 I need to implement async-channel/c-first-order and
 async-channel/c-stronger. I can probably figure out the latter, but I’m not
 even sure what the former is supposed to do.
 I need to implement a wrap-async-channel/c macro for the export. I’m not
 sure how this works, either. From looking at wrap-box/c, it seems to add
 some syntax properties, but I’m not sure what they do or how they work.
 Somehow, the blame information has to be correct. Is that what the wrap
 function does? Or do the async-channel functions need to be updated to
 assign blame?
 
 
 I’d really like to get this working, and I think I’m close, but I’m a little
 inexperienced. I’d appreciate any help, even if it’s just pointing me in the
 right direction.
 
 Thanks!
 
 
 
 _
  Racket Developers list:
  http://lists.racket-lang.org/dev
 


_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] Implementing contracts for async channels

2015-01-15 Thread Robby Findler
I think they should probably all be exported from racket/async-channel.

Unless there is some reason to modify the internals of racket/contract
to support them?

Robby

On Thu, Jan 15, 2015 at 4:50 PM, Alexis King lexi.lam...@gmail.com wrote:
 Sorry, I wasn’t clear. The chaperone/impersonate-async-channel functions are 
 exported from racket/async-channel. The async-channel contracts, however, are 
 exported from racket/contract.

 On Jan 15, 2015, at 14:41, Robby Findler ro...@eecs.northwestern.edu wrote:

 Just a small nit: why export that function from racket/contract and
 not an async-channel library?

 Robby


 On Thu, Jan 15, 2015 at 3:33 PM, Alexis King lexi.lam...@gmail.com wrote:
 As an update, I’ve made a bit more progress on this. I’ve implemented an
 impersonate-async-channel function, and I’ve actually included this in the
 exports from racket/contract. I also realized the blame information is
 correct, it works fine. Most of the other issues remain, as well as a few
 new questions:

 There is no impersonate-evt function, so I’m not sure that my implementation
 will work. What should I do about this?
 I’d assume this needs to be documented/tested as well. Where should those
 things be located?


 On Jan 14, 2015, at 23:44, Alexis King lexi.lam...@gmail.com wrote:

 Currently, async channels do not have contracts to check their contents.
 This is a problem for Typed Racket, and it prevents typed code from
 interacting with code that produces async channels.

 I started looking into how to add contracts to the language, and it seems to
 use the chaperones/impersonator system, as I suspected. However, async
 channels obviously cannot be impersonated, so I needed to implement that as
 well.

 I modified the async-channel struct to use generics to allow it to be
 impersonated or chaperoned, which I have exposed by implementing
 chaperone-async-channel. I then tried implementing async-channel/c. The
 internals of the contract system are a little beyond me, but I got a working
 solution by following the example of the box contracts.

 My work thus far can be found here:
 https://github.com/lexi-lambda/racket/commit/84b9f3604891f3f2061fb28ed4800af8afa4751b

 First of all, is this a correct approach? Have I done anything wrong, or
 should I have done anything differently? I didn’t find much documentation on
 the internals of either of these systems, so I mostly went about things as I
 found them.

 Second, obviously, not everything is implemented here. Among the additional
 necessary changes are:

 I need to implement support for impersonators and impersonator contracts
 (right now I’ve only bothered to do chaperones).
 I need to implement async-channel/c-first-order and
 async-channel/c-stronger. I can probably figure out the latter, but I’m not
 even sure what the former is supposed to do.
 I need to implement a wrap-async-channel/c macro for the export. I’m not
 sure how this works, either. From looking at wrap-box/c, it seems to add
 some syntax properties, but I’m not sure what they do or how they work.
 Somehow, the blame information has to be correct. Is that what the wrap
 function does? Or do the async-channel functions need to be updated to
 assign blame?


 I’d really like to get this working, and I think I’m close, but I’m a little
 inexperienced. I’d appreciate any help, even if it’s just pointing me in the
 right direction.

 Thanks!



 _
  Racket Developers list:
  http://lists.racket-lang.org/dev



_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] Implementing contracts for async channels

2015-01-15 Thread Robby Findler
Just a small nit: why export that function from racket/contract and
not an async-channel library?

Robby


On Thu, Jan 15, 2015 at 3:33 PM, Alexis King lexi.lam...@gmail.com wrote:
 As an update, I’ve made a bit more progress on this. I’ve implemented an
 impersonate-async-channel function, and I’ve actually included this in the
 exports from racket/contract. I also realized the blame information is
 correct, it works fine. Most of the other issues remain, as well as a few
 new questions:

 There is no impersonate-evt function, so I’m not sure that my implementation
 will work. What should I do about this?
 I’d assume this needs to be documented/tested as well. Where should those
 things be located?


 On Jan 14, 2015, at 23:44, Alexis King lexi.lam...@gmail.com wrote:

 Currently, async channels do not have contracts to check their contents.
 This is a problem for Typed Racket, and it prevents typed code from
 interacting with code that produces async channels.

 I started looking into how to add contracts to the language, and it seems to
 use the chaperones/impersonator system, as I suspected. However, async
 channels obviously cannot be impersonated, so I needed to implement that as
 well.

 I modified the async-channel struct to use generics to allow it to be
 impersonated or chaperoned, which I have exposed by implementing
 chaperone-async-channel. I then tried implementing async-channel/c. The
 internals of the contract system are a little beyond me, but I got a working
 solution by following the example of the box contracts.

 My work thus far can be found here:
 https://github.com/lexi-lambda/racket/commit/84b9f3604891f3f2061fb28ed4800af8afa4751b

 First of all, is this a correct approach? Have I done anything wrong, or
 should I have done anything differently? I didn’t find much documentation on
 the internals of either of these systems, so I mostly went about things as I
 found them.

 Second, obviously, not everything is implemented here. Among the additional
 necessary changes are:

 I need to implement support for impersonators and impersonator contracts
 (right now I’ve only bothered to do chaperones).
 I need to implement async-channel/c-first-order and
 async-channel/c-stronger. I can probably figure out the latter, but I’m not
 even sure what the former is supposed to do.
 I need to implement a wrap-async-channel/c macro for the export. I’m not
 sure how this works, either. From looking at wrap-box/c, it seems to add
 some syntax properties, but I’m not sure what they do or how they work.
 Somehow, the blame information has to be correct. Is that what the wrap
 function does? Or do the async-channel functions need to be updated to
 assign blame?


 I’d really like to get this working, and I think I’m close, but I’m a little
 inexperienced. I’d appreciate any help, even if it’s just pointing me in the
 right direction.

 Thanks!



 _
   Racket Developers list:
   http://lists.racket-lang.org/dev


_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] Implementing contracts for async channels

2015-01-15 Thread Sam Tobin-Hochstadt
On Thu, Jan 15, 2015 at 4:33 PM, Alexis King lexi.lam...@gmail.com wrote:
 As an update, I’ve made a bit more progress on this. I’ve implemented an
 impersonate-async-channel function, and I’ve actually included this in the
 exports from racket/contract. I also realized the blame information is
 correct, it works fine. Most of the other issues remain, as well as a few
 new questions:

 There is no impersonate-evt function, so I’m not sure that my implementation
 will work. What should I do about this?
 I’d assume this needs to be documented/tested as well. Where should those
 things be located?

Documentation for contracts is here:
https://github.com/plt/racket/blob/master/pkgs/racket-doc/scribblings/reference/contracts.scrbl
and in the dependent files.

Tests for contracts are here:
https://github.com/plt/racket/tree/master/pkgs/racket-test/tests/racket/contract

Sam



 On Jan 14, 2015, at 23:44, Alexis King lexi.lam...@gmail.com wrote:

 Currently, async channels do not have contracts to check their contents.
 This is a problem for Typed Racket, and it prevents typed code from
 interacting with code that produces async channels.

 I started looking into how to add contracts to the language, and it seems to
 use the chaperones/impersonator system, as I suspected. However, async
 channels obviously cannot be impersonated, so I needed to implement that as
 well.

 I modified the async-channel struct to use generics to allow it to be
 impersonated or chaperoned, which I have exposed by implementing
 chaperone-async-channel. I then tried implementing async-channel/c. The
 internals of the contract system are a little beyond me, but I got a working
 solution by following the example of the box contracts.

 My work thus far can be found here:
 https://github.com/lexi-lambda/racket/commit/84b9f3604891f3f2061fb28ed4800af8afa4751b

 First of all, is this a correct approach? Have I done anything wrong, or
 should I have done anything differently? I didn’t find much documentation on
 the internals of either of these systems, so I mostly went about things as I
 found them.

 Second, obviously, not everything is implemented here. Among the additional
 necessary changes are:

 I need to implement support for impersonators and impersonator contracts
 (right now I’ve only bothered to do chaperones).
 I need to implement async-channel/c-first-order and
 async-channel/c-stronger. I can probably figure out the latter, but I’m not
 even sure what the former is supposed to do.
 I need to implement a wrap-async-channel/c macro for the export. I’m not
 sure how this works, either. From looking at wrap-box/c, it seems to add
 some syntax properties, but I’m not sure what they do or how they work.
 Somehow, the blame information has to be correct. Is that what the wrap
 function does? Or do the async-channel functions need to be updated to
 assign blame?


 I’d really like to get this working, and I think I’m close, but I’m a little
 inexperienced. I’d appreciate any help, even if it’s just pointing me in the
 right direction.

 Thanks!



 _
   Racket Developers list:
   http://lists.racket-lang.org/dev


_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] question, issue(?) with the scope of identifiers passed into define-syntax-rule

2015-01-15 Thread Thomas Lynch
Yes, I see some of this at the bottom of the chapter 16 in the guide,  and
the recursion supported with
 (require
http://docs.racket-lang.org/reference/require.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._require%29%29
 (for-meta
http://docs.racket-lang.org/reference/require.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._for-meta%29%29
 n racket/base)).


On Fri, Jan 16, 2015 at 11:21 AM, Thomas Lynch 
thomas.ly...@reasoningtechnology.com wrote:

 Thank you for that nice explanation.  I'm reminded of the scope variables
 carried in Ruby.  In Mathematica the renaming of module variables is
 explicit.  There do not appear to be run phases there.  Also thanks for the
 working example using syntax parse.  Thus far I have working examples using
 define-syntax via datum and define-syntax with case (thanks to Matthais).

 The following questions might best be answered by pointing me to some
 other docs, haven't run across yet:

 Are there more than two phases?  There is the syntax phase, i.e. compile
 time phase, and then a run phase.  Lexical scope at the syntax phase would
 be static based textual layout of the program - i.e. lexical scope.  Then
 the macros (syntax transformers) are gone (as the syntax has been
 transformed) after the syntax phase.  At run time then, we have no access
 to the syntax object information?

 Academic question, but can syntax information, or other values be shared
 across phases?  As an example, could one store the file name, line, and
 column number for an identifier, the make use of that later?

 How is it that we do work inside of a macro, for example by making use of
 require-for-syntax?  Does that imply that the routines that we make use of
 in the macro for doing work had their own syntax phase, and now they are in
 run time phase during the macro's syntax phase?   .. then if those worker
 routines make use of macros ...   seems this recursion could be arbitrarily
 deep.

 Can the syntax analysis be explicitly invoked?   Sort of like (apply ...)
  or (eval ..) ?  Come to think of it, eval must do the syntax phase, then
 the run phase, so perhaps it is calls to that which causes the recursion.

 On Fri, Jan 16, 2015 at 11:01 AM, Alexander D. Knauth 
 alexan...@knauth.org wrote:

 But I think it’s important that it doesn’t use gensym or something like
 that, it uses syntax-marks, which means you can break these lexical scoping
 rules if you want/need to by using either syntax-local-introduce or
 datum-syntax:

 #lang racket
 (require syntax/parse/define)
 (define-simple-macro (with-tables stem body ...)
   #:with table-author-id (syntax-local-introduce #'table-author)
   (let([table-publication (string-append stem _publication)]
[table-author-id (string-append stem _author)]
[table-bridge-publication-author (string-append stem
 _bridge_publication_author)]
[table-unique-counters (string-append stem _unique_counters)]
)
 body ...
 ))
 (with-tables x table-author) ;”x_author


 On Jan 15, 2015, at 9:23 PM, Alexander McLin alex.mc...@gmail.com
 wrote:

 Warning I am still a Racket intermediate user but I've been studying
 syntactic extensions a lot the past several months.

 The problem here is macros in Racket have lexical scope just like
 procedures, they are hygienic macros. The identifiers you introduced in the
 with-tables macro only exist or refer to other bindings in the same lexical
 scope as where you originally wrote the macro.

 When you invoke the macro and pass in table-author, even though it is
 spelled the same as the identifier you wrote in the macro definition, they
 are not the same. When the macro expands, hygiene is implemented by
 renaming all identifiers in the macro to unique non-clashing symbols that
 don't conflict with others existing in the scope the macro is expanding in.

 The table-author identifier in the macro in the let form is renamed to
 something different like g6271 or something along those lines.

 Furthermore, you need to be careful about what you mean by evaluation. In
 the presence of macros, you have the concept of syntax phase(or
 compile-time or expand-time) evaluation versus run-time evaluation. When
 the macro is expanding, it does it thing, processing the original syntax
 into the new piece of syntax that replaces what was there previously such
 as (with-tables x table-author) which is then finally evaluated during
 run-time.

 (with-tables x table-author) will expand into something looking similar
 to the following, just to give you an idea of what macro expansion looks
 like:

 (let ((g6191 (string-append x _publication))
(g6271 (string-append x _author))
(g6369 (string-append x _bridge_publication_author))
(g6445 (string-append x _unique_counters)))
table-author)

 Note that the original table-author identifier has been replaced by a
 different identifier that still has the same binding you originally defined.

 The table-author identifier 

Re: [racket-dev] Implementing contracts for async channels

2015-01-15 Thread Alexis King
Sure thing, done. I’ve moved everything into racket/async-channel, added the 
missing functions, and added some tests. I squashed my commits into one, and 
the result is here:
https://github.com/lexi-lambda/racket/commit/0074ba13b712a87c9d05948ae075bcd74c7651e7
 
https://github.com/lexi-lambda/racket/commit/0074ba13b712a87c9d05948ae075bcd74c7651e7

Two simple points remain:

Where should the documentation go? Should it be under contracts or 
async-channels? I’d prefer the latter, but I’m not sure.
Since there is no impersonate-evt function, I don’t think my 
impersonate-async-channel function will actually work. Is that an accurate 
concern? How could I fix it?

Otherwise, I think this works fine and is probably ready to go.

 On Jan 15, 2015, at 15:09, Robby Findler ro...@eecs.northwestern.edu wrote:
 
 I think they should probably all be exported from racket/async-channel.
 
 Unless there is some reason to modify the internals of racket/contract
 to support them?
 
 Robby
 
 On Thu, Jan 15, 2015 at 4:50 PM, Alexis King lexi.lam...@gmail.com wrote:
 Sorry, I wasn’t clear. The chaperone/impersonate-async-channel functions are 
 exported from racket/async-channel. The async-channel contracts, however, 
 are exported from racket/contract.
 
 On Jan 15, 2015, at 14:41, Robby Findler ro...@eecs.northwestern.edu 
 wrote:
 
 Just a small nit: why export that function from racket/contract and
 not an async-channel library?
 
 Robby
 
 
 On Thu, Jan 15, 2015 at 3:33 PM, Alexis King lexi.lam...@gmail.com wrote:
 As an update, I’ve made a bit more progress on this. I’ve implemented an
 impersonate-async-channel function, and I’ve actually included this in the
 exports from racket/contract. I also realized the blame information is
 correct, it works fine. Most of the other issues remain, as well as a few
 new questions:
 
 There is no impersonate-evt function, so I’m not sure that my 
 implementation
 will work. What should I do about this?
 I’d assume this needs to be documented/tested as well. Where should those
 things be located?
 
 
 On Jan 14, 2015, at 23:44, Alexis King lexi.lam...@gmail.com wrote:
 
 Currently, async channels do not have contracts to check their contents.
 This is a problem for Typed Racket, and it prevents typed code from
 interacting with code that produces async channels.
 
 I started looking into how to add contracts to the language, and it seems 
 to
 use the chaperones/impersonator system, as I suspected. However, async
 channels obviously cannot be impersonated, so I needed to implement that as
 well.
 
 I modified the async-channel struct to use generics to allow it to be
 impersonated or chaperoned, which I have exposed by implementing
 chaperone-async-channel. I then tried implementing async-channel/c. The
 internals of the contract system are a little beyond me, but I got a 
 working
 solution by following the example of the box contracts.
 
 My work thus far can be found here:
 https://github.com/lexi-lambda/racket/commit/84b9f3604891f3f2061fb28ed4800af8afa4751b
 
 First of all, is this a correct approach? Have I done anything wrong, or
 should I have done anything differently? I didn’t find much documentation 
 on
 the internals of either of these systems, so I mostly went about things as 
 I
 found them.
 
 Second, obviously, not everything is implemented here. Among the additional
 necessary changes are:
 
 I need to implement support for impersonators and impersonator contracts
 (right now I’ve only bothered to do chaperones).
 I need to implement async-channel/c-first-order and
 async-channel/c-stronger. I can probably figure out the latter, but I’m not
 even sure what the former is supposed to do.
 I need to implement a wrap-async-channel/c macro for the export. I’m not
 sure how this works, either. From looking at wrap-box/c, it seems to add
 some syntax properties, but I’m not sure what they do or how they work.
 Somehow, the blame information has to be correct. Is that what the wrap
 function does? Or do the async-channel functions need to be updated to
 assign blame?
 
 
 I’d really like to get this working, and I think I’m close, but I’m a 
 little
 inexperienced. I’d appreciate any help, even if it’s just pointing me in 
 the
 right direction.
 
 Thanks!
 
 
 
 _
 Racket Developers list:
 http://lists.racket-lang.org/dev
 
 

_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] question, issue(?) with the scope of identifiers passed into define-syntax-rule

2015-01-15 Thread Alexander McLin
Warning I am still a Racket intermediate user but I've been studying
syntactic extensions a lot the past several months.

The problem here is macros in Racket have lexical scope just like
procedures, they are hygienic macros. The identifiers you introduced in the
with-tables macro only exist or refer to other bindings in the same lexical
scope as where you originally wrote the macro.

When you invoke the macro and pass in table-author, even though it is
spelled the same as the identifier you wrote in the macro definition, they
are not the same. When the macro expands, hygiene is implemented by
renaming all identifiers in the macro to unique non-clashing symbols that
don't conflict with others existing in the scope the macro is expanding in.

The table-author identifier in the macro in the let form is renamed to
something different like g6271 or something along those lines.

Furthermore, you need to be careful about what you mean by evaluation. In
the presence of macros, you have the concept of syntax phase(or
compile-time or expand-time) evaluation versus run-time evaluation. When
the macro is expanding, it does it thing, processing the original syntax
into the new piece of syntax that replaces what was there previously such
as (with-tables x table-author) which is then finally evaluated during
run-time.

(with-tables x table-author) will expand into something looking similar
to the following, just to give you an idea of what macro expansion looks
like:

(let ((g6191 (string-append x _publication))
   (g6271 (string-append x _author))
   (g6369 (string-append x _bridge_publication_author))
   (g6445 (string-append x _unique_counters)))
   table-author)

Note that the original table-author identifier has been replaced by a
different identifier that still has the same binding you originally defined.

The table-author identifier you passed to the macro gets inserted in the
body position and then the expanded code is evaluated at run-time and of
course gives you a run-time error since table-author does not refer to
anything and thus when it's evaluated, it is recognized as an undefined
identifier.

(with-tables x hello) works because what you get in return is:

(let ((g6191 (string-append x _publication))
   (g6271 (string-append x _author))
   (g6369 (string-append x _bridge_publication_author))
   (g6445 (string-append x _unique_counters)))
   hello)

hello is just a self-evaluating string giving you back hello from
within the let form.

On Thu, Jan 15, 2015 at 12:12 AM, Thomas Lynch 
thomas.ly...@reasoningtechnology.com wrote:

 I have a simple syntax rule:

   Welcome to Racket v5.2.1.
   racket@ (define-syntax-rule (with-tables stem body ...)
 (let(
   [table-publication (string-append stem _publication)]
   [table-author (string-append stem _author)]
   [table-bridge-publication-author (string-append stem
 _bridge_publication_author)]
   [table-unique-counters (string-append stem _unique_counters)]
   )
   body ...
   ))

 Which works fine when I don't reference the environment defined by the let:


   racket@
   racket@ (with-tables x hello)

   hello


 However when I pass it an identifier corresponding to one of the variables
 defined in the let:

   racket@ (with-tables x table-author)
   reference to undefined identifier: table-author
   stdin::1167: table-author

 The identifier passed in doesn't seem to be part of the local let context,
 but carried in a different context, or perhaps it was evaluated as an
 operand.  I didn't expect either of those.  Can someone point me at a
 description of the expected behavior, or give me a tip here on what is
 happening and why.

 ... in Wolfram language there is a 'Hold' operator for situations like
 this.  Apparently inside the macro we have to do some evaluation to handle
 the work of the macro,  is that why the operand is evaluated?

 Thanks in advance for explaining the evaluation/context model here.

 Thomas

 _
   Racket Developers list:
   http://lists.racket-lang.org/dev


_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] question, issue(?) with the scope of identifiers passed into define-syntax-rule

2015-01-15 Thread Alexander D. Knauth
But I think it’s important that it doesn’t use gensym or something like that, 
it uses syntax-marks, which means you can break these lexical scoping rules if 
you want/need to by using either syntax-local-introduce or datum-syntax:

#lang racket
(require syntax/parse/define)
(define-simple-macro (with-tables stem body ...)
  #:with table-author-id (syntax-local-introduce #'table-author)
  (let([table-publication (string-append stem _publication)]
   [table-author-id (string-append stem _author)]
   [table-bridge-publication-author (string-append stem 
_bridge_publication_author)]
   [table-unique-counters (string-append stem _unique_counters)]
   )
body ...
))
(with-tables x table-author) ;”x_author


On Jan 15, 2015, at 9:23 PM, Alexander McLin alex.mc...@gmail.com wrote:

 Warning I am still a Racket intermediate user but I've been studying 
 syntactic extensions a lot the past several months.
 
 The problem here is macros in Racket have lexical scope just like procedures, 
 they are hygienic macros. The identifiers you introduced in the with-tables 
 macro only exist or refer to other bindings in the same lexical scope as 
 where you originally wrote the macro.
 
 When you invoke the macro and pass in table-author, even though it is spelled 
 the same as the identifier you wrote in the macro definition, they are not 
 the same. When the macro expands, hygiene is implemented by renaming all 
 identifiers in the macro to unique non-clashing symbols that don't conflict 
 with others existing in the scope the macro is expanding in.
 
 The table-author identifier in the macro in the let form is renamed to 
 something different like g6271 or something along those lines.
 
 Furthermore, you need to be careful about what you mean by evaluation. In the 
 presence of macros, you have the concept of syntax phase(or compile-time or 
 expand-time) evaluation versus run-time evaluation. When the macro is 
 expanding, it does it thing, processing the original syntax into the new 
 piece of syntax that replaces what was there previously such as (with-tables 
 x table-author) which is then finally evaluated during run-time.
 
 (with-tables x table-author) will expand into something looking similar to 
 the following, just to give you an idea of what macro expansion looks like:
 
 (let ((g6191 (string-append x _publication))
(g6271 (string-append x _author))
(g6369 (string-append x _bridge_publication_author))
(g6445 (string-append x _unique_counters)))
table-author)
 
 Note that the original table-author identifier has been replaced by a 
 different identifier that still has the same binding you originally defined.
 
 The table-author identifier you passed to the macro gets inserted in the body 
 position and then the expanded code is evaluated at run-time and of course 
 gives you a run-time error since table-author does not refer to anything and 
 thus when it's evaluated, it is recognized as an undefined identifier.
 
 (with-tables x hello) works because what you get in return is:
 
 (let ((g6191 (string-append x _publication))
(g6271 (string-append x _author))
(g6369 (string-append x _bridge_publication_author))
(g6445 (string-append x _unique_counters)))
hello)
 
 hello is just a self-evaluating string giving you back hello from within 
 the let form.
 
 On Thu, Jan 15, 2015 at 12:12 AM, Thomas Lynch 
 thomas.ly...@reasoningtechnology.com wrote:
 I have a simple syntax rule:
 
   Welcome to Racket v5.2.1.
   racket@ (define-syntax-rule (with-tables stem body ...)
 (let(
   [table-publication (string-append stem _publication)]
   [table-author (string-append stem _author)]
   [table-bridge-publication-author (string-append stem 
 _bridge_publication_author)]
   [table-unique-counters (string-append stem _unique_counters)]
   )
   body ...
   ))
 
 Which works fine when I don't reference the environment defined by the let:
 
   racket@
   racket@ (with-tables x hello)
   hello
 
 
 However when I pass it an identifier corresponding to one of the variables 
 defined in the let:
 
   racket@ (with-tables x table-author)
   reference to undefined identifier: table-author
   stdin::1167: table-author
 
 The identifier passed in doesn't seem to be part of the local let context, 
 but carried in a different context, or perhaps it was evaluated as an 
 operand.  I didn't expect either of those.  Can someone point me at a 
 description of the expected behavior, or give me a tip here on what is 
 happening and why.
 
 ... in Wolfram language there is a 'Hold' operator for situations like this.  
 Apparently inside the macro we have to do some evaluation to handle the work 
 of the macro,  is that why the operand is evaluated? 
 
 Thanks in advance for explaining the evaluation/context model here.
 
 Thomas 
 
 _
   Racket Developers list:
   

Re: [racket-dev] Announcing Soft Contract Verification tool

2015-01-15 Thread David Van Horn
On 1/15/15, 2:13 PM, Asumu Takikawa wrote:
 On 2015-01-14 19:11:59 -0500, David Van Horn wrote:
 If you have questions, comments, bugs, or any other feedback, let
 us know, or just file bug reports on the GitHub source code.
 
 Nice tool! I like the web interface too.
 
 I was confused by this interaction though. Clicking verify on
 this:
 
 (module fact racket (define (factorial x) (if (zero? x) 1 (* x
 (factorial (sub1 x) (provide (contract-out [factorial (- (=/c
 0) (=/c 0))])))
 
 gives me:
 
 Contract violation: 'fact' violates '='. Value 0.105 violates
 predicate real? An example module that breaks it: (module user
 racket (require (submod .. fact)) (factorial 0.105)) 
 (Verification takes 0.05s)
 
 but the value 0.105 shouldn't violate the predicate real? I think.

This is reporting that the fact module can break the contract on =
when it uses =/c; that's a bug in our modelling of =/c, which we
currently have as:

(define (=/c n)
  (lambda (m)
(= m n)))

But should be:

(define (=/c n)
  (lambda (m)
(and (real? m)
 (= m n

That said, if you change it to (and/c real? (=/c 0)), it says there's
a counterexample of 2.0, but that's because we check contracts on
recursive calls (and should not).

Thanks!

David

_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] Announcing Soft Contract Verification tool

2015-01-15 Thread David Van Horn
On 1/15/15, 2:48 PM, Robby Findler wrote:
 Can you randomly make up programs from your grammar, get example 
 errors from the tool, and then run those programs to see if you
 find bugs in the analysis like that one?

Yes, we're planning to do this.

 That said, I don't see how the bug in =/c is coming in here. Can
 you explain more?

On further inspection, the counterexample is wrong.  (There are
counterexamples due to the model of =/c, but the one that reported is
not an actual one.)  This will be fixed shortly.

David

_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] question, issue(?) with the scope of identifiers passed into define-syntax-rule

2015-01-15 Thread Thomas Lynch
Thank you for that nice explanation.  I'm reminded of the scope variables
carried in Ruby.  In Mathematica the renaming of module variables is
explicit.  There do not appear to be run phases there.  Also thanks for the
working example using syntax parse.  Thus far I have working examples using
define-syntax via datum and define-syntax with case (thanks to Matthais).

The following questions might best be answered by pointing me to some other
docs, haven't run across yet:

Are there more than two phases?  There is the syntax phase, i.e. compile
time phase, and then a run phase.  Lexical scope at the syntax phase would
be static based textual layout of the program - i.e. lexical scope.  Then
the macros (syntax transformers) are gone (as the syntax has been
transformed) after the syntax phase.  At run time then, we have no access
to the syntax object information?

Academic question, but can syntax information, or other values be shared
across phases?  As an example, could one store the file name, line, and
column number for an identifier, the make use of that later?

How is it that we do work inside of a macro, for example by making use of
require-for-syntax?  Does that imply that the routines that we make use of
in the macro for doing work had their own syntax phase, and now they are in
run time phase during the macro's syntax phase?   .. then if those worker
routines make use of macros ...   seems this recursion could be arbitrarily
deep.

Can the syntax analysis be explicitly invoked?   Sort of like (apply ...)
 or (eval ..) ?  Come to think of it, eval must do the syntax phase, then
the run phase, so perhaps it is calls to that which causes the recursion.

On Fri, Jan 16, 2015 at 11:01 AM, Alexander D. Knauth alexan...@knauth.org
wrote:

 But I think it’s important that it doesn’t use gensym or something like
 that, it uses syntax-marks, which means you can break these lexical scoping
 rules if you want/need to by using either syntax-local-introduce or
 datum-syntax:

 #lang racket
 (require syntax/parse/define)
 (define-simple-macro (with-tables stem body ...)
   #:with table-author-id (syntax-local-introduce #'table-author)
   (let([table-publication (string-append stem _publication)]
[table-author-id (string-append stem _author)]
[table-bridge-publication-author (string-append stem
 _bridge_publication_author)]
[table-unique-counters (string-append stem _unique_counters)]
)
 body ...
 ))
 (with-tables x table-author) ;”x_author


 On Jan 15, 2015, at 9:23 PM, Alexander McLin alex.mc...@gmail.com wrote:

 Warning I am still a Racket intermediate user but I've been studying
 syntactic extensions a lot the past several months.

 The problem here is macros in Racket have lexical scope just like
 procedures, they are hygienic macros. The identifiers you introduced in the
 with-tables macro only exist or refer to other bindings in the same lexical
 scope as where you originally wrote the macro.

 When you invoke the macro and pass in table-author, even though it is
 spelled the same as the identifier you wrote in the macro definition, they
 are not the same. When the macro expands, hygiene is implemented by
 renaming all identifiers in the macro to unique non-clashing symbols that
 don't conflict with others existing in the scope the macro is expanding in.

 The table-author identifier in the macro in the let form is renamed to
 something different like g6271 or something along those lines.

 Furthermore, you need to be careful about what you mean by evaluation. In
 the presence of macros, you have the concept of syntax phase(or
 compile-time or expand-time) evaluation versus run-time evaluation. When
 the macro is expanding, it does it thing, processing the original syntax
 into the new piece of syntax that replaces what was there previously such
 as (with-tables x table-author) which is then finally evaluated during
 run-time.

 (with-tables x table-author) will expand into something looking similar
 to the following, just to give you an idea of what macro expansion looks
 like:

 (let ((g6191 (string-append x _publication))
(g6271 (string-append x _author))
(g6369 (string-append x _bridge_publication_author))
(g6445 (string-append x _unique_counters)))
table-author)

 Note that the original table-author identifier has been replaced by a
 different identifier that still has the same binding you originally defined.

 The table-author identifier you passed to the macro gets inserted in the
 body position and then the expanded code is evaluated at run-time and of
 course gives you a run-time error since table-author does not refer to
 anything and thus when it's evaluated, it is recognized as an undefined
 identifier.

 (with-tables x hello) works because what you get in return is:

 (let ((g6191 (string-append x _publication))
(g6271 (string-append x _author))
(g6369 (string-append x _bridge_publication_author))

Re: [racket-dev] Announcing Soft Contract Verification tool

2015-01-15 Thread Benjamin Greenman
I tried writing a small program, but got stuck pretty early on. When I try
verifying the divides? function below, the tool times out. What's
happening?

(module div racket
  (provide (contract-out [divides? (- positive? positive? boolean?)]))

  (define (positive? x)
(and (integer? x) (= 0 x)))

  (define (divides? a b)
(cond [(= 0 b) #t]
  [( b a) #f]
  [else (divides? a (- b a))]))

)

On Thu, Jan 15, 2015 at 3:14 PM, David Van Horn dvanh...@cs.umd.edu wrote:

 On 1/15/15, 2:48 PM, Robby Findler wrote:
  Can you randomly make up programs from your grammar, get example
  errors from the tool, and then run those programs to see if you
  find bugs in the analysis like that one?

 Yes, we're planning to do this.

  That said, I don't see how the bug in =/c is coming in here. Can
  you explain more?

 On further inspection, the counterexample is wrong.  (There are
 counterexamples due to the model of =/c, but the one that reported is
 not an actual one.)  This will be fixed shortly.

 David

 _
   Racket Developers list:
   http://lists.racket-lang.org/dev

_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] [plt] Push #29680: master branch updated

2015-01-14 Thread Matthew Flatt
I'll adjust the docs to clarify that the permission change followed by
delete is a non-atomic sequence, with no attempt to revert a permission
change if the delete fails.

Ending up with just the permission change is one possible outcome, and
I hope the clarification will also make other outcomes more apparent.
For example, it could happen that X's permission is changed, then X is
concurrently replaced by a new file again without write permission, and
the still-in-progress delete fails due to a permission failure after
all.

At Wed, 14 Jan 2015 09:31:37 -0600, Robby Findler wrote:
 Is it perhaps worth being more explicit about this possibility in the
 docs? I'm thinking of a sentence that says when the parameter is
 set, delete-file may have only the effect of changing the permissions
 on the file or similar.
 
 Robby
 
 On Wed, Jan 14, 2015 at 8:29 AM, Matthew Flatt mfl...@cs.utah.edu wrote:
  At Wed, 14 Jan 2015 09:07:08 -0500, Neil Toronto wrote:
  On 01/13/2015 02:00 PM, mfl...@racket-lang.org wrote:
   9f3c82c Matthew Flatt mfl...@racket-lang.org 2015-01-13 08:47
   :
   | Windows: change `delete-{file,directory}` to attempt permission 
 correction
   |
   | If a file or directory delete fails, try adjusting the file or 
   directory
   | permissions to allow writes, then try deleting again. This process 
 should
   | provide a more Unix-like experience and make programs behave more
   | consistently.
   |
   | A new `current-force-delete-permissions` parameter provides access to
   | the raw native behavior.
 
  If I'm understand the new behavior correctly, it's possible for a
  failing `delete-file` to raise an exception, having changed the file to
  be writable. Do I have that right, and is that OK?
 
  That is correct. I'm not too happy about it, but I think it's a good
  trade-off relative to the old behavior (as a default).
 
  _
Racket Developers list:
http://lists.racket-lang.org/dev
_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] [racket/web-server] 1c6411: Removing out-dated WebSocket implementation

2015-01-14 Thread Sam Tobin-Hochstadt
How does this fit with backward compatibility?

Sam

On Wed, Jan 14, 2015 at 2:26 PM, Jay McCarthy jay.mccar...@gmail.com wrote:
   Branch: refs/heads/master
   Home:   https://github.com/racket/web-server
   Commit: 1c6411c670c1aa86df507a99c64dfc2701d36c0f
   
 https://github.com/racket/web-server/commit/1c6411c670c1aa86df507a99c64dfc2701d36c0f
   Author: Jay McCarthy jay.mccar...@gmail.com
   Date:   2015-01-14 (Wed, 14 Jan 2015)

   Changed paths:
 R web-server-lib/net/websocket.rkt
 R web-server-lib/net/websocket/client.rkt
 R web-server-lib/net/websocket/server.rkt

   Log Message:
   ---
   Removing out-dated WebSocket implementation


_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] [racket/web-server] 1c6411: Removing out-dated WebSocket implementation

2015-01-14 Thread Jay McCarthy
The plan is to add a dependency on the net-rfc* package with update-implies
OR move that code into this place.

This is a bit of a special case given that the old code doesn't work at
all. There are basically no Web browsers that support that version of
WebSockets, so it is only breaking for things that use this code or a few
very old browsers.

Jay

On Wed, Jan 14, 2015 at 2:37 PM, Sam Tobin-Hochstadt sa...@cs.indiana.edu
wrote:

 How does this fit with backward compatibility?

 Sam

 On Wed, Jan 14, 2015 at 2:26 PM, Jay McCarthy jay.mccar...@gmail.com
 wrote:
Branch: refs/heads/master
Home:   https://github.com/racket/web-server
Commit: 1c6411c670c1aa86df507a99c64dfc2701d36c0f
 
 https://github.com/racket/web-server/commit/1c6411c670c1aa86df507a99c64dfc2701d36c0f
Author: Jay McCarthy jay.mccar...@gmail.com
Date:   2015-01-14 (Wed, 14 Jan 2015)
 
Changed paths:
  R web-server-lib/net/websocket.rkt
  R web-server-lib/net/websocket/client.rkt
  R web-server-lib/net/websocket/server.rkt
 
Log Message:
---
Removing out-dated WebSocket implementation
 
 




-- 
Jay McCarthy
http://jeapostrophe.github.io

   Wherefore, be not weary in well-doing,
  for ye are laying the foundation of a great work.
And out of small things proceedeth that which is great.
  - DC 64:33
_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] [plt] Push #29680: master branch updated

2015-01-14 Thread Matthew Flatt
At Wed, 14 Jan 2015 09:07:08 -0500, Neil Toronto wrote:
 On 01/13/2015 02:00 PM, mfl...@racket-lang.org wrote:
  9f3c82c Matthew Flatt mfl...@racket-lang.org 2015-01-13 08:47
  :
  | Windows: change `delete-{file,directory}` to attempt permission correction
  |
  | If a file or directory delete fails, try adjusting the file or directory
  | permissions to allow writes, then try deleting again. This process should
  | provide a more Unix-like experience and make programs behave more
  | consistently.
  |
  | A new `current-force-delete-permissions` parameter provides access to
  | the raw native behavior.
 
 If I'm understand the new behavior correctly, it's possible for a 
 failing `delete-file` to raise an exception, having changed the file to 
 be writable. Do I have that right, and is that OK?

That is correct. I'm not too happy about it, but I think it's a good
trade-off relative to the old behavior (as a default).

_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] Typed Racket does not play nice with submodules

2015-01-13 Thread Alexis King
After playing around with Asumu’s branch to use require again instead of 
local-require, submodules still don’t work. I’m not sure why, but I’ve 
collected a series of examples of how different things fail in different ways. 
Perhaps someone more intimately familiar with the internals of Typed Racket and 
Racket’s module system can help to figure something out from this information.

First, I have this simple program:

#lang typed/racket/base

(require (for-syntax racket/base
 syntax/parse
 typed-racket/private/syntax-properties))

(define-syntax (begin-ignored stx)
  (syntax-parse stx
[(_ ex:expr ...)
 (quasisyntax/loc stx
   #,(ignore #'(begin ex ...)))]))

(module foo racket
  (define x 7)
  (provide x))

(require 'foo)

(begin-ignored
  x)

This fails with the following error message:

link: module mismatch;
 possibly, bytecode file needs re-compile because dependencies changed
  importing module: 'explode
  exporting module: (submod /tmp/explode.rkt foo)
  exporting phase level: 0
  internal explanation: variable not provided (directly or indirectly) in: x

This is bizarre, and rather unhelpful. Note that this shouldn't involve any 
typechecking at all—using ignore should prevent that from happening—but somehow 
TR’s still making this fail. However, swapping typed/racket/base for 
typed/racket/base/no-check (perhaps unsurprisingly) makes it work fine.

Next up, I tried cheating a bit by using two submodules instead of just one. I 
hoped the following program would be a hacky workaround:

#lang typed/racket/base

(module foo racket/base
  (define x 7)
  (provide x))

(module bar typed/racket/base
  (require/typed
   (submod .. foo)
   [x Number])
  (define y : Number x)
  (provide y))

(require 'bar)
y

Like the above, this program typechecks. However, it still fails with the exact 
same error message. Still, I was able to glean some more information from this 
oddity. Removing the final line of the program causes it to run successfully, 
as expected. Now, evaluating y in the REPL gives me a different error message:

Type Checker: missing type for identifier;
 consider using `require/typed' to import it
  identifier: y
  from module: (submod . bar) in: y

If anything, this feels even stranger. The provided variable is clearly typed, 
but apparently TR has decided it’s not. Why? I don’t know.

As a semi-interesting side note, simply changing the #lang declaration of the 
above program to racket/base makes it work without a hitch, demonstrating that 
the problem doesn’t seem to be within the require/typed form itself, but 
somehow has something to do with how TR handles the resulting binding?

Any ideas on what’s happening here? I’ve tried digging through some of the 
Typed Racket source, but I’m really too unfamiliar with how everything fits 
together to figure it out just yet.

Also, Asumu, a related problem: are there any issues with changing 
local-require back to require that would break anything else? Or can you 
possibly implement that change in TR with no issues?

 On Jan 12, 2015, at 08:06, Asumu Takikawa as...@ccs.neu.edu 
 mailto:as...@ccs.neu.edu wrote:
 
 On 2015-01-11 23:29:28 -0800, Alexis King wrote:
   This is a real problem, since Typed Racket’s require/typed form uses
   local-require, which in turn uses syntax-local-lift-require. This means
   that require/typed currently cannot require submodules.
 
 Interesting, thanks for tracking this down! IIRC Typed Racket switched
 to using `local-require` in order to support uses of `require/typed` in
 the REPL/top-level.
 
 (as the comment on
 https://github.com/racket/typed-racket/blob/master/typed-racket-lib/typed-racket/utils/require-contract.rkt#L57
  
 https://github.com/racket/typed-racket/blob/master/typed-racket-lib/typed-racket/utils/require-contract.rkt#L57
 notes)
 
 So one possible solution is to switch back to using `require` but also
 overhaul how TR handles the REPL to avoid these issues.
 
 (for the REPL, local expanding everything at once doesn't work well
 because an early definition in a `begin` has to be registered
 before later clauses are typechecked)
 
 Cheers,
 Asumu

_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] segfault during make

2015-01-08 Thread Matthew Flatt
Do you have the latest images-doc and/or gui-lib packages?

Recently, there was a problem with the images documentation where it
tried to use `racket/gui` at document-build time. At the same time,
there was also a problem in `racket/gui` that could cause a crash
(mainly on Mac OS X) after `racket/gui` was used during
documentation-build time. Both of those problems have been fixed.

At Tue, 06 Jan 2015 22:14:53 +, Spencer Florence wrote:
 Hey all,
 
 When I try to run `make` on the current head the build segfaults while
 making the documentation. The last few lines of the output are:
 
 raco setup: 2 rendering:
 pkgs/pfds/pfds/scribblings/functional-data-structures.scrbl
 raco setup: 1 rendering:
 pkgs/future-visualizer/future-visualizer/scribblings/future-visualizer.scrbl
 raco setup: 1 rendering: pkgs/games/scribblings/games.scrbl
 raco setup: 1 rendering:
 pkgs/racket-doc/scribblings/getting-started/getting-started.scrbl
 raco setup: 1 rendering: pkgs/games/gl-board-game/gl-board-game.scrbl
 raco setup: 1 rendering: pkgs/htdp-doc/graphics/scribblings/graphics.scrbl
 raco setup: 1 rendering: pkgs/gui-doc/scribblings/gui/gui.scrbl
 raco setup: 0 rendering: pkgs/racket-doc/help/help.scrbl
 raco setup: 0 rendering: pkgs/htdp-doc/htdp/htdp.scrbl
 raco setup: 0 rendering:
 pkgs/htdp-doc/scribblings/htdp-langs/htdp-langs.scrbl
 raco setup: 3 rendering: pkgs/html-doc/html/html.scrbl
 raco setup: 3 rendering: pkgs/images-doc/images/scribblings/images.scrbl
 raco setup: 1 rendering: pkgs/racket-doc/scribblings/inside/inside.scrbl
 raco setup: 1 rendering: pkgs/racket-doc/json/json.scrbl
 raco setup: 1 rendering: pkgs/lazy/lazy.scrbl
 raco setup: 1 rendering:
 pkgs/macro-debugger/macro-debugger/macro-debugger.scrbl
 raco setup: 0 rendering: pkgs/make/make.scrbl
 raco setup: 0 rendering: pkgs/math-doc/math/scribblings/math.scrbl
 raco setup: 1 rendering: pkgs/racket-doc/scribblings/more/more.scrbl
 raco setup: 1 rendering: pkgs/gui-doc/mrlib/scribblings/mrlib.scrbl
 raco setup: 1 rendering: pkgs/mysterx/scribblings/mysterx.scrbl
 raco setup: 1 rendering: pkgs/mzcom/mzcom.scrbl
 raco setup: 1 rendering:
 pkgs/compatibility-doc/mzlib/scribblings/mzlib.scrbl
 raco setup: 1 rendering: pkgs/mzscheme-doc/mzscheme/mzscheme.scrbl
 raco setup: 1 rendering: pkgs/net-doc/net/scribblings/net.scrbl
 raco setup: 1 rendering: pkgs/racket-doc/openssl/openssl.scrbl
 raco setup: 1 rendering:
 pkgs/optimization-coach/optimization-coach/scribblings/optimization-coach.scrb
 l
 raco setup: 1 rendering:
 pkgs/parser-tools-doc/parser-tools/parser-tools.scrbl
 raco setup: 1 rendering: pkgs/pict-doc/pict/scribblings/pict.scrbl
 raco setup: 3 rendering:
 pkgs/pict-snip-doc/scribblings/pict-snip/pict-snip.scrbl
 make[1]: *** [plain-in-place] Segmentation fault: 11
 
 I'm on OSX 10.10.1.
 
 Anyone know whats going on/how to debug this?
 
 --spencer
 _
   Racket Developers list:
   http://lists.racket-lang.org/dev
_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] segfault during make

2015-01-08 Thread Spencer Florence
aha! That fixed it. Thanks.

On Thu Jan 08 2015 at 6:18:12 AM Matthew Flatt mfl...@cs.utah.edu wrote:

 Do you have the latest images-doc and/or gui-lib packages?

 Recently, there was a problem with the images documentation where it
 tried to use `racket/gui` at document-build time. At the same time,
 there was also a problem in `racket/gui` that could cause a crash
 (mainly on Mac OS X) after `racket/gui` was used during
 documentation-build time. Both of those problems have been fixed.

 At Tue, 06 Jan 2015 22:14:53 +, Spencer Florence wrote:
  Hey all,
 
  When I try to run `make` on the current head the build segfaults while
  making the documentation. The last few lines of the output are:
 
  raco setup: 2 rendering:
  pkgs/pfds/pfds/scribblings/functional-data-structures.scrbl
  raco setup: 1 rendering:
  pkgs/future-visualizer/future-visualizer/scribblings/
 future-visualizer.scrbl
  raco setup: 1 rendering: pkgs/games/scribblings/games.scrbl
  raco setup: 1 rendering:
  pkgs/racket-doc/scribblings/getting-started/getting-started.scrbl
  raco setup: 1 rendering: pkgs/games/gl-board-game/gl-board-game.scrbl
  raco setup: 1 rendering: pkgs/htdp-doc/graphics/
 scribblings/graphics.scrbl
  raco setup: 1 rendering: pkgs/gui-doc/scribblings/gui/gui.scrbl
  raco setup: 0 rendering: pkgs/racket-doc/help/help.scrbl
  raco setup: 0 rendering: pkgs/htdp-doc/htdp/htdp.scrbl
  raco setup: 0 rendering:
  pkgs/htdp-doc/scribblings/htdp-langs/htdp-langs.scrbl
  raco setup: 3 rendering: pkgs/html-doc/html/html.scrbl
  raco setup: 3 rendering: pkgs/images-doc/images/
 scribblings/images.scrbl
  raco setup: 1 rendering: pkgs/racket-doc/scribblings/
 inside/inside.scrbl
  raco setup: 1 rendering: pkgs/racket-doc/json/json.scrbl
  raco setup: 1 rendering: pkgs/lazy/lazy.scrbl
  raco setup: 1 rendering:
  pkgs/macro-debugger/macro-debugger/macro-debugger.scrbl
  raco setup: 0 rendering: pkgs/make/make.scrbl
  raco setup: 0 rendering: pkgs/math-doc/math/scribblings/math.scrbl
  raco setup: 1 rendering: pkgs/racket-doc/scribblings/more/more.scrbl
  raco setup: 1 rendering: pkgs/gui-doc/mrlib/scribblings/mrlib.scrbl
  raco setup: 1 rendering: pkgs/mysterx/scribblings/mysterx.scrbl
  raco setup: 1 rendering: pkgs/mzcom/mzcom.scrbl
  raco setup: 1 rendering:
  pkgs/compatibility-doc/mzlib/scribblings/mzlib.scrbl
  raco setup: 1 rendering: pkgs/mzscheme-doc/mzscheme/mzscheme.scrbl
  raco setup: 1 rendering: pkgs/net-doc/net/scribblings/net.scrbl
  raco setup: 1 rendering: pkgs/racket-doc/openssl/openssl.scrbl
  raco setup: 1 rendering:
  pkgs/optimization-coach/optimization-coach/scribblings/optimization-
 coach.scrb
  l
  raco setup: 1 rendering:
  pkgs/parser-tools-doc/parser-tools/parser-tools.scrbl
  raco setup: 1 rendering: pkgs/pict-doc/pict/scribblings/pict.scrbl
  raco setup: 3 rendering:
  pkgs/pict-snip-doc/scribblings/pict-snip/pict-snip.scrbl
  make[1]: *** [plain-in-place] Segmentation fault: 11
 
  I'm on OSX 10.10.1.
 
  Anyone know whats going on/how to debug this?
 
  --spencer
  _
Racket Developers list:
http://lists.racket-lang.org/dev

_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] having zo files from two versions

2015-01-08 Thread Matthew Flatt
I see. If you compile with v5.2.1 first, then it puts files immediately
in compiled, and those will be found by v6.1.

If you compile v6.1 first, then the files go in a subdirectory of
compiled, and they won't interfere with v5.2.1, while v6.1 will
continue to find the files in the subdirectory. That's what I tried, so
I didn't think of the problem with the other order.

Were you able to solve this by compiling with v6.1 first? Or some other
approach?

At Tue, 6 Jan 2015 15:04:40 -0800, Dan Liebgold wrote:
 Ok, that seems to be exactly what I'm looking for -- however I tried it and
 it eventually seems to wind up using just the compiled path during raco
 setup.
 
 Example output is here (I've echoed PLTCOMPILEDROOTS at the top, and note
 this is under windows): http://pasterack.org/pastes/45913
 
 Is that enough context to see the issue?
 
 On Tue, Jan 6, 2015 at 11:58 AM, Matthew Flatt mfl...@cs.utah.edu wrote:
 
  At Tue, 06 Jan 2015 14:14:22 -0500, Neil Van Dyke wrote:
   Dan Liebgold wrote on 01/06/2015 02:00 PM:
What is a straightforward way to designate the compiled directory to
look for zo files in that can be based on the Racket version?  I'd
like to have Racket 5.2.1 and 6.1 running in parallel to aid in
upgrading our version.
Thanks!
  
   I'd like for this to be the default behavior for Racket.
  
   One possible way: Insert a directory level between the `compiled`
   directory and its contents, with the directory named with the Racket
   version number with which the code is compiled.  Only that Racket
   version will run that compiled code.
 
  Although it's not the default, you can get that behavior by setting the
  `PLTCOMPILEDROOTS` environment variable to
 
   compiled/@(version):
 
  The trailing : allows compiled files to be found in compiled in the
  installation, while newly generated .zo files are put in a
  version-specific subdirectory.
 
  See also
 
   http://lists.racket-lang.org/dev/archive/2012-September/010386.html
 
 
 
 
 -- 
 Dan Liebgold[dan.liebg...@gmail.com]
_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] having zo files from two versions

2015-01-08 Thread Dan Liebgold
Actually specifying two different compile root directories seem to work for
most things.

The exception is my json lib. I have it for 5.2.1 (since it wasn't included
in the standard dist). I'd prefer 6.1 to find the standard one, but it's ok
if it uses mine instead. The problem is that maybe it gets confused between
the two and give me this error:

link: module mismatch;
 possibly, bytecode file needs re-compile because dependencies changed
  importing module:
/tmp/src-copy/danl/main/shared/src/plt/collects/dc2/target.rkt
  exporting module:
/tmp/src-copy/danl/main/shared/src/plt/collects/json/main.rkt
  exporting phase level: 0
  internal explanation: variable not provided (directly or indirectly and
at the expected position)
  in: jsexpr-string31.12
  context...:
   /tmp/src-copy/danl/main/shared/src/plt/collects/dc2/target.rkt: [running
body]
   /tmp/src-copy/danl/main/shared/src/plt/collects/dc2/debug.rkt:
[traversing imports]
   /tmp/src-copy/danl/main/shared/src/plt/collects/dc2/listener.rkt:
[traversing imports]
   /tmp/src-copy/danl/main/shared/src/plt/collects/dc2/main.rkt:
[traversing imports]




On Thu, Jan 8, 2015 at 8:09 AM, Matthew Flatt mfl...@cs.utah.edu wrote:

 I see. If you compile with v5.2.1 first, then it puts files immediately
 in compiled, and those will be found by v6.1.

 If you compile v6.1 first, then the files go in a subdirectory of
 compiled, and they won't interfere with v5.2.1, while v6.1 will
 continue to find the files in the subdirectory. That's what I tried, so
 I didn't think of the problem with the other order.

 Were you able to solve this by compiling with v6.1 first? Or some other
 approach?

 At Tue, 6 Jan 2015 15:04:40 -0800, Dan Liebgold wrote:
  Ok, that seems to be exactly what I'm looking for -- however I tried it
 and
  it eventually seems to wind up using just the compiled path during raco
  setup.
 
  Example output is here (I've echoed PLTCOMPILEDROOTS at the top, and note
  this is under windows): http://pasterack.org/pastes/45913
 
  Is that enough context to see the issue?
 
  On Tue, Jan 6, 2015 at 11:58 AM, Matthew Flatt mfl...@cs.utah.edu
 wrote:
 
   At Tue, 06 Jan 2015 14:14:22 -0500, Neil Van Dyke wrote:
Dan Liebgold wrote on 01/06/2015 02:00 PM:
 What is a straightforward way to designate the compiled
 directory to
 look for zo files in that can be based on the Racket version?  I'd
 like to have Racket 5.2.1 and 6.1 running in parallel to aid in
 upgrading our version.
 Thanks!
   
I'd like for this to be the default behavior for Racket.
   
One possible way: Insert a directory level between the `compiled`
directory and its contents, with the directory named with the Racket
version number with which the code is compiled.  Only that Racket
version will run that compiled code.
  
   Although it's not the default, you can get that behavior by setting the
   `PLTCOMPILEDROOTS` environment variable to
  
compiled/@(version):
  
   The trailing : allows compiled files to be found in compiled in the
   installation, while newly generated .zo files are put in a
   version-specific subdirectory.
  
   See also
  
http://lists.racket-lang.org/dev/archive/2012-September/010386.html
  
  
 
 
  --
  Dan Liebgold[dan.liebg...@gmail.com]




-- 
Dan Liebgold[dan.liebg...@gmail.com]
_
  Racket Developers list:
  http://lists.racket-lang.org/dev


  1   2   3   4   5   6   7   8   9   10   >