Re: [racket-dev] TR tests sometimes fail with a promise error

2013-04-04 Thread Sam Tobin-Hochstadt
This is a long-standing intermittent bug somewhere in {DrDr, promises,
rackunit, TR's use of rackunit} that no one has, to my knowledge, made
any progress in tracking down.

Perhaps the thread is being killed by DrDr at some point, although I
have reproduced it at the command line.

Sam

On Thu, Apr 4, 2013 at 1:33 PM, Eric Dobson  wrote:
> Sometimes TR tests fail with the error
>
> force: promise's thread terminated without result or exception
>
>   promise: #
>
>   context...:
>
>/opt/plt/builds//trunk/collects/racket/promise.rkt:98:2
>
>
> /opt/plt/builds//trunk/collects/tests/typed-racket/optimizer/run.rkt:50:3:
> for-loop
>
>
> /opt/plt/builds//trunk/collects/tests/typed-racket/optimizer/run.rkt:44:0:
> mk-suite
>
> How can this happen? Is the thread getting killed? Also since this
> error doesn't have blame information I don't know if this is an
> internal promise error or if TR is misusing the promise library.
> _
>   Racket Developers list:
>   http://lists.racket-lang.org/dev
_
  Racket Developers list:
  http://lists.racket-lang.org/dev


[racket-dev] Confusion of difference of evaluating syntax vs compiled code?

2013-04-04 Thread Danny Yoo
I'm running into dynamic evaluation behavior that I don't quite
understand yet.  My example is:

https://gist.github.com/dyoo/5314045

It's meant as an experiment to see whether it's possible to avoid 3d
syntax in certain places like the gui-debugger.  I try to throw in a
wrench on lines 52-54:

https://gist.github.com/dyoo/5314045#file-annotation-example-rkt-L52-L54

but thankfully, when I evaluate this in DrRacket, I get the results I expect.


However, that's when I'm evaluated the annotated+compiled code.  If I
modify the example so I'm evaluating just the annotated code, by
modifying lines 117-119
https://gist.github.com/dyoo/5314045#file-annotation-example-rkt-L117-L119

from:

;; But we can evaluate it in ns:
(printf "evaluating the annotated code\n")
(eval compiled-code ns)

to:

;; But we can evaluate it in ns:
(printf "evaluating the annotated code\n")
(eval annotated-code ns)


I get the unexpected shadowing I'm trying to avoid.  Why am I getting
the clash here, and not in the compiled code?
_
  Racket Developers list:
  http://lists.racket-lang.org/dev


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

2013-04-04 Thread Asumu Takikawa
On 2013-04-04 10:29:30 -0700, Eric Dobson wrote:
> Can we make it so that IP addresses are immutable? This would require
> changing make-ip-address to have a call to make-immutable-bytes in
> each case.

That's a good suggestion, thanks.

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


[racket-dev] TR tests sometimes fail with a promise error

2013-04-04 Thread Eric Dobson
Sometimes TR tests fail with the error

force: promise's thread terminated without result or exception

  promise: #

  context...:

   /opt/plt/builds//trunk/collects/racket/promise.rkt:98:2

   
/opt/plt/builds//trunk/collects/tests/typed-racket/optimizer/run.rkt:50:3:
for-loop

   
/opt/plt/builds//trunk/collects/tests/typed-racket/optimizer/run.rkt:44:0:
mk-suite

How can this happen? Is the thread getting killed? Also since this
error doesn't have blame information I don't know if this is an
internal promise error or if TR is misusing the promise library.
_
  Racket Developers list:
  http://lists.racket-lang.org/dev


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

2013-04-04 Thread Eric Dobson
Sorry make-immutable-bytes should be bytes->immutable-bytes.

On Thu, Apr 4, 2013 at 10:29 AM, Eric Dobson  wrote:
> Can we make it so that IP addresses are immutable? This would require
> changing make-ip-address to have a call to make-immutable-bytes in
> each case.
>
> On Thu, Apr 4, 2013 at 10:07 AM,   wrote:
>> asumu has updated `master' from 8246d073c0 to 92102a2f07.
>>   http://git.racket-lang.org/plt/8246d073c0..92102a2f07
>>
>> =[ 2 Commits ]==
>> Directory summary:
>>   55.6% collects/net/private/
>>   44.3% collects/net/
>>
>> ~~
>>
>> 4e76ae8 Asumu Takikawa  2013-04-03 15:05
>> :
>> | Add an IP address library
>> |
>> | The library currently lives in a private subfolder so
>> | that the interface can still be changed. The idea is to
>> | eventually make it a top-level `net` library once it is
>> | more mature.
>> :
>>   A collects/net/private/ip.rkt
>>
>> ~~
>>
>> 92102a2 Asumu Takikawa  2013-04-04 11:53
>> :
>> | Use net/private/ip in net/dns
>> |
>> | This simplifies the code by outsourcing IP
>> | address functionality to net/private/ip.
>> :
>>   M collects/net/dns.rkt | 230 
>> +---
>>
>> =[ Overall Diff ]===
>>
>> collects/net/dns.rkt
>> 
>> --- OLD/collects/net/dns.rkt
>> +++ NEW/collects/net/dns.rkt
>> @@ -2,7 +2,8 @@
>>
>>  ;; DNS query library for Racket
>>
>> -(require racket/bool
>> +(require "private/ip.rkt"
>> + racket/bool
>>   racket/contract
>>   racket/format
>>   racket/list
>> @@ -14,13 +15,17 @@
>>
>>  (provide (contract-out
>>[dns-get-address
>> -   (->* (ip-address-string? string?)
>> +   (->* ((or/c ip-address? ip-address-string?) string?)
>>  (#:ipv6? any/c)
>>  ip-address-string?)]
>>[dns-get-name
>> -   (-> ip-address-string? ip-address-string? string?)]
>> +   (-> (or/c ip-address? ip-address-string?)
>> +   (or/c ip-address? ip-address-string?)
>> +   string?)]
>>[dns-get-mail-exchanger
>> -   (-> ip-address-string? string? (or/c bytes? string?))]
>> +   (-> (or/c ip-address? ip-address-string?)
>> +   string?
>> +   (or/c bytes? string?))]
>>[dns-find-nameserver
>> (-> (or/c ip-address-string? #f))]))
>>
>> @@ -29,95 +34,8 @@
>>  ;; UDP retry timeout:
>>  (define INIT-TIMEOUT 50)
>>
>> -;; Contract utilities and Data Definitions
>> -;;
>> +;; Data Definitions
>>  ;; An LB is a (Listof Bytes)
>> -;;
>> -;; An IPAddressString passes the following predicate
>> -(define (ip-address-string? val)
>> -  (and (string? val)
>> -   (or (ipv4-string? val)
>> -   (ipv6-string? val
>> -
>> -;; String -> Boolean
>> -;; Check if the input string represents an IPv4 address
>> -(define (ipv4-string? str)
>> -  ;; String -> Boolean
>> -  ;; check if the given string has leading zeroes
>> -  (define (has-leading-zeroes? str)
>> -(and (> (string-length str) 1)
>> - (char=? (string-ref str 0) #\0)))
>> -  (define matches
>> -(regexp-match #px"^(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})$"
>> -  str))
>> -  (and matches
>> -   (= (length matches) 5)
>> -   ;; check that each octet field is an octet
>> -   (andmap byte? (map string->number (cdr matches)))
>> -   ;; leading zeroes lead to query errors
>> -   (not (ormap has-leading-zeroes? matches
>> -
>> -;; String -> Boolean
>> -;; Check if the input string represents an IPv6 address
>> -;; TODO: support dotted quad notation
>> -(define (ipv6-string? str)
>> -  (define re-::/: #px"^([0-9a-fA-F]{1,4})(::|:)")
>> -  (define re-:: #px"^()(::)")
>> -  (define re-: #px"^([0-9a-fA-F]{1,4})(:)")
>> -  (define re-end #px"^[0-9a-fA-F]{1,4}$")
>> -  (or (regexp-match? #px"^::$" str) ; special case
>> -  (let loop ([octet-pairs '()]  ; keep octet-pairs to count
>> - [::? #f]   ; seen a :: in the string yet?
>> - [str str])
>> -;; match digit groups and a separator
>> -(define matches
>> -  (if ::?
>> -  (regexp-match re-: str)
>> -  (or (regexp-match re-:: str)
>> -  (regexp-match re-::/: str
>> -(cond [matches
>> -   (match-define (list match digits sep) matches)
>> -   (define rest (substring str (string-length match)))
>> -   ;; we need to make sure there is only one :: at most
>> -   (if (or ::? (string=? sep "::"))
>> -   (loop (cons digits octet-pairs) #t rest)
>> -   (loop (cons digits octet-pairs) #f rest))]
>> -  [else
>> -   (and ;; if there isn't a ::, we need 7+1 octet-pairs
>> -(implies (not ::?) (= (length octet-pairs

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

2013-04-04 Thread Eric Dobson
Can we make it so that IP addresses are immutable? This would require
changing make-ip-address to have a call to make-immutable-bytes in
each case.

On Thu, Apr 4, 2013 at 10:07 AM,   wrote:
> asumu has updated `master' from 8246d073c0 to 92102a2f07.
>   http://git.racket-lang.org/plt/8246d073c0..92102a2f07
>
> =[ 2 Commits ]==
> Directory summary:
>   55.6% collects/net/private/
>   44.3% collects/net/
>
> ~~
>
> 4e76ae8 Asumu Takikawa  2013-04-03 15:05
> :
> | Add an IP address library
> |
> | The library currently lives in a private subfolder so
> | that the interface can still be changed. The idea is to
> | eventually make it a top-level `net` library once it is
> | more mature.
> :
>   A collects/net/private/ip.rkt
>
> ~~
>
> 92102a2 Asumu Takikawa  2013-04-04 11:53
> :
> | Use net/private/ip in net/dns
> |
> | This simplifies the code by outsourcing IP
> | address functionality to net/private/ip.
> :
>   M collects/net/dns.rkt | 230 
> +---
>
> =[ Overall Diff ]===
>
> collects/net/dns.rkt
> 
> --- OLD/collects/net/dns.rkt
> +++ NEW/collects/net/dns.rkt
> @@ -2,7 +2,8 @@
>
>  ;; DNS query library for Racket
>
> -(require racket/bool
> +(require "private/ip.rkt"
> + racket/bool
>   racket/contract
>   racket/format
>   racket/list
> @@ -14,13 +15,17 @@
>
>  (provide (contract-out
>[dns-get-address
> -   (->* (ip-address-string? string?)
> +   (->* ((or/c ip-address? ip-address-string?) string?)
>  (#:ipv6? any/c)
>  ip-address-string?)]
>[dns-get-name
> -   (-> ip-address-string? ip-address-string? string?)]
> +   (-> (or/c ip-address? ip-address-string?)
> +   (or/c ip-address? ip-address-string?)
> +   string?)]
>[dns-get-mail-exchanger
> -   (-> ip-address-string? string? (or/c bytes? string?))]
> +   (-> (or/c ip-address? ip-address-string?)
> +   string?
> +   (or/c bytes? string?))]
>[dns-find-nameserver
> (-> (or/c ip-address-string? #f))]))
>
> @@ -29,95 +34,8 @@
>  ;; UDP retry timeout:
>  (define INIT-TIMEOUT 50)
>
> -;; Contract utilities and Data Definitions
> -;;
> +;; Data Definitions
>  ;; An LB is a (Listof Bytes)
> -;;
> -;; An IPAddressString passes the following predicate
> -(define (ip-address-string? val)
> -  (and (string? val)
> -   (or (ipv4-string? val)
> -   (ipv6-string? val
> -
> -;; String -> Boolean
> -;; Check if the input string represents an IPv4 address
> -(define (ipv4-string? str)
> -  ;; String -> Boolean
> -  ;; check if the given string has leading zeroes
> -  (define (has-leading-zeroes? str)
> -(and (> (string-length str) 1)
> - (char=? (string-ref str 0) #\0)))
> -  (define matches
> -(regexp-match #px"^(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})$"
> -  str))
> -  (and matches
> -   (= (length matches) 5)
> -   ;; check that each octet field is an octet
> -   (andmap byte? (map string->number (cdr matches)))
> -   ;; leading zeroes lead to query errors
> -   (not (ormap has-leading-zeroes? matches
> -
> -;; String -> Boolean
> -;; Check if the input string represents an IPv6 address
> -;; TODO: support dotted quad notation
> -(define (ipv6-string? str)
> -  (define re-::/: #px"^([0-9a-fA-F]{1,4})(::|:)")
> -  (define re-:: #px"^()(::)")
> -  (define re-: #px"^([0-9a-fA-F]{1,4})(:)")
> -  (define re-end #px"^[0-9a-fA-F]{1,4}$")
> -  (or (regexp-match? #px"^::$" str) ; special case
> -  (let loop ([octet-pairs '()]  ; keep octet-pairs to count
> - [::? #f]   ; seen a :: in the string yet?
> - [str str])
> -;; match digit groups and a separator
> -(define matches
> -  (if ::?
> -  (regexp-match re-: str)
> -  (or (regexp-match re-:: str)
> -  (regexp-match re-::/: str
> -(cond [matches
> -   (match-define (list match digits sep) matches)
> -   (define rest (substring str (string-length match)))
> -   ;; we need to make sure there is only one :: at most
> -   (if (or ::? (string=? sep "::"))
> -   (loop (cons digits octet-pairs) #t rest)
> -   (loop (cons digits octet-pairs) #f rest))]
> -  [else
> -   (and ;; if there isn't a ::, we need 7+1 octet-pairs
> -(implies (not ::?) (= (length octet-pairs) 7))
> -;; this is the +1 octet pair
> -(regexp-match? re-end str))]
> -
> -(module+ test
> -  (check-true (ip-address-string? "8.8.8.8"))
> -  (check-true (ip-address-string? "12.81.255.109"))
> -  (check-true