Re: [racket-dev] The `var` pattern in `match`

2012-11-29 Thread Carl Eastlund
Having something like the var pattern can be useful for macros that
expand into uses of match, if the macro doesn't want to expose that a bound
variable will be a match pattern and therefore must not be _ or 
Granted, there are ways around this, but personally I think it would be
nice if match supported this pattern.  I would, however, entirely support
renaming this pattern to something more obscure, like
match:pattern-variable or something, so that unintentional uses stop
being a problem.

Carl Eastlund


On Thu, Nov 29, 2012 at 12:17 AM, Neil Toronto neil.toro...@gmail.comwrote:

 On 11/28/2012 06:04 PM, David Van Horn wrote:

 On 11/28/12 7:53 PM, Sam Tobin-Hochstadt wrote:

 Currently, `match` provides a pattern named `var`, which makes `(var
 id)` equivalent to `id`, but without special cases for things like `_`
 and `...`.

 However, this frequently conflicts with structures that people define,
 and is rarely used other than accidentally.  I'd therefore like to
 remove it entirely.


 + (expt 2 (expt 2 (expt 2 (expt 2 2


 Since I've never used `var' and it sounds like a great idea to get rid of
 it, I'll see David's repeated exponential and raise it by \aleph_0.

 Note that downvotes must now at least sum to \aleph_1 to retain the `var'
 pattern. One downvote for every real number is sufficient.

 Neil ⊥


 _
  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] The `var` pattern in `match`

2012-11-29 Thread Matthias Felleisen

+1


On Nov 29, 2012, at 7:31 AM, Carl Eastlund wrote:

 Having something like the var pattern can be useful for macros that expand 
 into uses of match, if the macro doesn't want to expose that a bound variable 
 will be a match pattern and therefore must not be _ or   Granted, 
 there are ways around this, but personally I think it would be nice if match 
 supported this pattern.  I would, however, entirely support renaming this 
 pattern to something more obscure, like match:pattern-variable or 
 something, so that unintentional uses stop being a problem.
 
 Carl Eastlund
 
 
 On Thu, Nov 29, 2012 at 12:17 AM, Neil Toronto neil.toro...@gmail.com wrote:
 On 11/28/2012 06:04 PM, David Van Horn wrote:
 On 11/28/12 7:53 PM, Sam Tobin-Hochstadt wrote:
 Currently, `match` provides a pattern named `var`, which makes `(var
 id)` equivalent to `id`, but without special cases for things like `_`
 and `...`.
 
 However, this frequently conflicts with structures that people define,
 and is rarely used other than accidentally.  I'd therefore like to
 remove it entirely.
 
 + (expt 2 (expt 2 (expt 2 (expt 2 2
 
 Since I've never used `var' and it sounds like a great idea to get rid of it, 
 I'll see David's repeated exponential and raise it by \aleph_0.
 
 Note that downvotes must now at least sum to \aleph_1 to retain the `var' 
 pattern. One downvote for every real number is sufficient.
 
 Neil ⊥
 
 
 _
  Racket Developers list:
  http://lists.racket-lang.org/dev
 
 _
  Racket Developers list:
  http://lists.racket-lang.org/dev



smime.p7s
Description: S/MIME cryptographic signature
_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] The `var` pattern in `match`

2012-11-29 Thread David Van Horn

On 11/29/12 7:31 AM, Carl Eastlund wrote:

Having something like the var pattern can be useful for macros that
expand into uses of match, if the macro doesn't want to expose that a
bound variable will be a match pattern and therefore must not be _ or
  Granted, there are ways around this, but personally I think it
would be nice if match supported this pattern.  I would, however,
entirely support renaming this pattern to something more obscure, like
match:pattern-variable or something, so that unintentional uses stop
being a problem.


I think the real solution is to have (whatever name you give) `var' be 
something that is matched as an identifier and not a literal so that 
programmers can rename the pattern.  But I know from talking with Sam 
this would be a big change for match.


In the meantime, something more obscure than `var' would go a long way 
toward me not cursing Sam's good name every time I write an AST.


David

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


Re: [racket-dev] The `var` pattern in `match`

2012-11-29 Thread Sam Tobin-Hochstadt
On Thu, Nov 29, 2012 at 10:40 AM, David Van Horn dvanh...@ccs.neu.edu wrote:
 On 11/29/12 7:31 AM, Carl Eastlund wrote:

 Having something like the var pattern can be useful for macros that
 expand into uses of match, if the macro doesn't want to expose that a
 bound variable will be a match pattern and therefore must not be _ or
   Granted, there are ways around this, but personally I think it
 would be nice if match supported this pattern.  I would, however,
 entirely support renaming this pattern to something more obscure, like
 match:pattern-variable or something, so that unintentional uses stop
 being a problem.


 I think the real solution is to have (whatever name you give) `var' be
 something that is matched as an identifier and not a literal so that
 programmers can rename the pattern.  But I know from talking with Sam this
 would be a big change for match.

Making `var` specifically be matched by binding would be possible --
it would be less of a change than removing it entirely.

--
sam th
sa...@ccs.neu.edu
_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] The `var` pattern in `match`

2012-11-29 Thread David Van Horn

On 11/29/12 1:45 PM, Sam Tobin-Hochstadt wrote:

On Thu, Nov 29, 2012 at 10:40 AM, David Van Horn dvanh...@ccs.neu.edu wrote:

On 11/29/12 7:31 AM, Carl Eastlund wrote:


Having something like the var pattern can be useful for macros that
expand into uses of match, if the macro doesn't want to expose that a
bound variable will be a match pattern and therefore must not be _ or
  Granted, there are ways around this, but personally I think it
would be nice if match supported this pattern.  I would, however,
entirely support renaming this pattern to something more obscure, like
match:pattern-variable or something, so that unintentional uses stop
being a problem.



I think the real solution is to have (whatever name you give) `var' be
something that is matched as an identifier and not a literal so that
programmers can rename the pattern.  But I know from talking with Sam this
would be a big change for match.


Making `var` specifically be matched by binding would be possible --
it would be less of a change than removing it entirely.


I would still like the default to be something other than `var'.

(BTW, it looks like `var' is not an indexed term in the docs for match.)

David

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


Re: [racket-dev] The `var` pattern in `match`

2012-11-28 Thread David Van Horn

On 11/28/12 7:53 PM, Sam Tobin-Hochstadt wrote:

Currently, `match` provides a pattern named `var`, which makes `(var
id)` equivalent to `id`, but without special cases for things like `_`
and `...`.

However, this frequently conflicts with structures that people define,
and is rarely used other than accidentally.  I'd therefore like to
remove it entirely.


+ (expt 2 (expt 2 (expt 2 (expt 2 2

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


Re: [racket-dev] The `var` pattern in `match`

2012-11-28 Thread Neil Toronto

On 11/28/2012 06:04 PM, David Van Horn wrote:

On 11/28/12 7:53 PM, Sam Tobin-Hochstadt wrote:

Currently, `match` provides a pattern named `var`, which makes `(var
id)` equivalent to `id`, but without special cases for things like `_`
and `...`.

However, this frequently conflicts with structures that people define,
and is rarely used other than accidentally.  I'd therefore like to
remove it entirely.


+ (expt 2 (expt 2 (expt 2 (expt 2 2


Since I've never used `var' and it sounds like a great idea to get rid 
of it, I'll see David's repeated exponential and raise it by \aleph_0.


Note that downvotes must now at least sum to \aleph_1 to retain the 
`var' pattern. One downvote for every real number is sufficient.


Neil ⊥

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