Re: [racket-dev] Regular expression types [was Re: [racket-bug] all/14455: wrong type for hash]

2014-04-20 Thread Matthias Felleisen

Sorry guys, I had something different in mind. 


When I ask people to port my typical 'Hell' code, I tend to 
suggest that all XML-related code should stay in Untyped. In 
most cases this kind of S-expression manipulation is hairy
from an ordinary TR pov but has a simple interface to the 
Typed world. It really is a case where typed-untyped cooperation
shines. 

But eventually such pieces of code should/could be typed too. 
For those cases, the XML type systems that Sam mentioned are
ideal and one day we may wish to develop a TR+XML (Xduce?) 
combination. 







On Apr 20, 2014, at 3:06 PM, Eric Dobson wrote:

> Asumu has a rough draft of a commit that would allow this to work, I
> don't know the current status though.
> 
> https://github.com/plt/racket/pull/564
> 
> I was thinking about the problem and I think our current union types
> and recursive types covers a lot of ground.
> 
> For example as one user wanted to do, exactly one vector and bunch of
> numbers: (Rec T (U (Cons (Vectorof Real) (Listof Real)) (Cons Real
> T))).
> 
> 
> On Sun, Apr 20, 2014 at 11:38 AM, Matthias Felleisen
>  wrote:
>> 
>> This might be one of those areas where we could 'generalize' gradual typing.
>> 
>> 
>> On Apr 19, 2014, at 7:37 PM, Sam Tobin-Hochstadt wrote:
>> 
>>> On Sat, Apr 19, 2014 at 7:24 PM, Neil Toronto  
>>> wrote:
 Are there type systems that can? It seems like you could specify this type
 and similar ones using regular expressions.
>>> 
>>> There is lots of work on types for XML specification that can handle
>>> this sort of thing, I believe, but not specifically in the context of
>>> function arguments.
>>> 
>>> Note that TR can handle alternating types just fine in lists, for
>>> example -- it's just that the function argument sequence is different.
>>> 
>>> Sam
>>> _
>>> 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] Regular expression types [was Re: [racket-bug] all/14455: wrong type for hash]

2014-04-20 Thread Eric Dobson
Asumu has a rough draft of a commit that would allow this to work, I
don't know the current status though.

https://github.com/plt/racket/pull/564

I was thinking about the problem and I think our current union types
and recursive types covers a lot of ground.

For example as one user wanted to do, exactly one vector and bunch of
numbers: (Rec T (U (Cons (Vectorof Real) (Listof Real)) (Cons Real
T))).


On Sun, Apr 20, 2014 at 11:38 AM, Matthias Felleisen
 wrote:
>
> This might be one of those areas where we could 'generalize' gradual typing.
>
>
> On Apr 19, 2014, at 7:37 PM, Sam Tobin-Hochstadt wrote:
>
>> On Sat, Apr 19, 2014 at 7:24 PM, Neil Toronto  wrote:
>>> Are there type systems that can? It seems like you could specify this type
>>> and similar ones using regular expressions.
>>
>> There is lots of work on types for XML specification that can handle
>> this sort of thing, I believe, but not specifically in the context of
>> function arguments.
>>
>> Note that TR can handle alternating types just fine in lists, for
>> example -- it's just that the function argument sequence is different.
>>
>> Sam
>> _
>>  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] Regular expression types [was Re: [racket-bug] all/14455: wrong type for hash]

2014-04-20 Thread Asumu Takikawa
On 2014-04-20 14:38:50 -0400, Matthias Felleisen wrote:
> This might be one of those areas where we could 'generalize' gradual
> typing.

I think we could do it without fundamentally changing anything about
gradual typing.

The issue is that uniform rest args assume that the type is always a
`(Listof Foo)`. We could instead allow users to write down any type for
the whole rest args list (classes take this approach for `init-rest`).

While it's not a fundamental change, it's also not easy. It would also
complicate the system and add more type syntax for a pretty modest
benefit. (more important for classes which have weird initialization
patterns)

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


Re: [racket-dev] Regular expression types [was Re: [racket-bug] all/14455: wrong type for hash]

2014-04-20 Thread Matthias Felleisen

This might be one of those areas where we could 'generalize' gradual typing. 


On Apr 19, 2014, at 7:37 PM, Sam Tobin-Hochstadt wrote:

> On Sat, Apr 19, 2014 at 7:24 PM, Neil Toronto  wrote:
>> Are there type systems that can? It seems like you could specify this type
>> and similar ones using regular expressions.
> 
> There is lots of work on types for XML specification that can handle
> this sort of thing, I believe, but not specifically in the context of
> function arguments.
> 
> Note that TR can handle alternating types just fine in lists, for
> example -- it's just that the function argument sequence is different.
> 
> Sam
> _
>  Racket Developers list:
>  http://lists.racket-lang.org/dev


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


Re: [racket-dev] Regular expression types [was Re: [racket-bug] all/14455: wrong type for hash]

2014-04-19 Thread Sam Tobin-Hochstadt
On Sat, Apr 19, 2014 at 7:24 PM, Neil Toronto  wrote:
> Are there type systems that can? It seems like you could specify this type
> and similar ones using regular expressions.

There is lots of work on types for XML specification that can handle
this sort of thing, I believe, but not specifically in the context of
function arguments.

Note that TR can handle alternating types just fine in lists, for
example -- it's just that the function argument sequence is different.

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


[racket-dev] Regular expression types [was Re: [racket-bug] all/14455: wrong type for hash]

2014-04-19 Thread Neil Toronto
Are there type systems that can? It seems like you could specify this 
type and similar ones using regular expressions.


In my research, I'll probably use regular expressions to represent sets 
of strings. I've been curious about how well regular-expression-like 
things generalize to cartesian products with repeating structure.


Neil ⊥

On 04/19/2014 03:44 PM, Eric Dobson wrote:

The type for hash is conservative. TR currently cannot express the
alternating requirement that hash requires.

On Sat, Apr 19, 2014 at 2:40 PM,   wrote:

A new problem report is waiting at
   http://bugs.racket-lang.org/query/?cmd=view&pr=14455

Reported by Alex Knauth for release: 6.0

*** Description:
the type for hash appears to be (All (a b) (-> (HashTable a b))), so it's not 
letting me supply it with arguments, saying that it expects 0 arguments

*** How to repeat:
#lang typed/racket
(hash 0 0)



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