Re: [racket-users] Why is this exception giving me an arity error?

2017-02-17 Thread Shu-Hung You
This works completely fine on a fresh racket REPL:

> (exn:fail:bmtc:unknown-user "message" (current-continuation-marks) "bob")
(exn:fail:bmtc:unknown-user "message" # "bob")

I guess there might be some inconsistency in REPL states. Starting a
fresh racket should work, or maybe use (enter! "./module.rkt")?

Best,
Shu-Hung


On Fri, Feb 17, 2017 at 12:17 PM, David Storrs  wrote:
> I have the following file:
>
>
> #lang racket
>
> (provide (all-defined-out))
>
> (struct exn:fail:bmtc exn:fail ()
> #:extra-constructor-name make-exn:fail:bmtc
> #:transparent)
>
> ;; I expect this to take all the arguments from exn (its ultimate
> superclass), plus a new argument which comes last.
> (struct exn:fail:bmtc:unknown-user exn:fail:bmtc (username)
> #:extra-constructor-name make-exn:fail:bmtc:unknown-user
> #:transparent)
>
>
> At the command line:
>
> $ racket
> -> (require "network/exceptions")
>
> -> exn:fail:bmtc:unknown-user
> #
>
> -> (exn:fail:bmtc:unknown-user "message" (current-continuation-marks) "bob")
> ; exn:fail:bmtc:unknown-user: arity mismatch;
> ;  the expected number of arguments does not match the given number
> ;   expected: 2
> ;   given: 3
> ; [,bt for context]
>
> -> (exn:fail:bmtc:unknown-user "msg" (current-continuation-marks))
> (exn:fail:bmtc:unknown-user "msg" #)
>
>
> Given the declaration of exn:fail:bmtc:unknown-user I was expecting it to
> take a third argument.  What am I missing?
>
>
> Note that I'm using Emacs and the command line, not DrRacket.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Re: Why is this exception giving me an arity error?

2017-02-17 Thread David Storrs
Oh.  When I change the name to exn:fail:bmtc:unknownuser  it works fine.  I
guess '-' is a disallowed character for exceptions?

-> (struct exn:fail:bmtc:unknownuser exn:fail:bmtc (username) #:transparent)

-> (exn:fail:bmtc:unknownuser "msg" (current-continuation-marks) "foo")
(exn:fail:bmtc:unknownuser "msg" # ... "foo")



Underscore also works:

-> (struct exn:fail:bmtc:unknown_user exn:fail:bmtc (username)
#:transparent)

-> (exn:fail:bmtc:unknown_user "msg" # ... "foo")
(exn:fail:bmtc:unknown_user "msg" # ... "foo")



On Fri, Feb 17, 2017 at 1:17 PM, David Storrs 
wrote:

> I have the following file:
>
>
> #lang racket
>
> (provide (all-defined-out))
>
> (struct exn:fail:bmtc exn:fail ()
> #:extra-constructor-name make-exn:fail:bmtc
> #:transparent)
>
> ;; I expect this to take all the arguments from exn (its ultimate
> superclass), plus a new argument which comes last.
> (struct exn:fail:bmtc:unknown-user exn:fail:bmtc (username)
> #:extra-constructor-name make-exn:fail:bmtc:unknown-user
> #:transparent)
>
>
> At the command line:
>
> $ racket
> -> (require "network/exceptions")
>
> -> exn:fail:bmtc:unknown-user
> #
>
> -> (exn:fail:bmtc:unknown-user "message" (current-continuation-marks)
> "bob")
> ; exn:fail:bmtc:unknown-user: arity mismatch;
> ;  the expected number of arguments does not match the given number
> ;   expected: 2
> ;   given: 3
> ; [,bt for context]
>
> -> (exn:fail:bmtc:unknown-user "msg" (current-continuation-marks))
> (exn:fail:bmtc:unknown-user "msg" #)
>
>
> Given the declaration of exn:fail:bmtc:unknown-user I was expecting it to
> take a third argument.  What am I missing?
>
>
> Note that I'm using Emacs and the command line, not DrRacket.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Drawing arbitrary binding arrows with Check Syntax

2017-02-17 Thread Robby Findler
[ sorry for the long delay in getting back to this ]

On Wed, Oct 19, 2016 at 11:56 AM, Alex Knauth  wrote:
>
>> On Oct 19, 2016, at 12:26 PM, Alexis King  wrote:
>>
>>> On Oct 19, 2016, at 4:06 AM, Robby Findler  
>>> wrote:
>>>
>>> That's the best approach we currently have. Of course, we could support a 
>>> new property that was "connect srclocs" or something.
>>
>> Do you think it would make sense to have a property that uses
>> bound-identifier=? rather than free-identifier=? to connect
>> identifiers? Managing scopes seems a bit more feasible to do
>> procedurally than managing bindings (since you can use
>> make-syntax-introducer to explicitly add them), but I’m not sure
>> if that would be much better than a “connect srclocs” option.
>
> This is weird, because when 'disappeared-use is used with a normal binding it 
> makes sense to use free-identifier=? so that it can look through 
> rename-transformers. But when used with 'disappeared-binding, I would want it 
> to go by the scopes (bound-identifier=?), because there is no binding to look 
> at.
>
> For most of the macros I've made using this, I have wanted it to use 
> free-identifier=? if there is a binding, but bound-identifier=? otherwise. Is 
> that the behavior that makes sense for check-syntax arrows?

I think that probably it doesn't make sense to change the existing
properties, but it may make sense to add another one. I'm inclined to
leave things as they are, as it seems likely that the macro author can
always just insert a `let` that has the right binding structure for
the more complex cases, and that that's probably easier to reason
about for the macro author.

I've added a note to the Check Syntax docs along these lines:

https://github.com/racket/drracket/commit/b3244db4422422ac96753387f598b2f7a15e975f

Robby

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.