Boo

Shortcuts to interfaces

Details

  • Type: Wish Wish
  • Status: Resolved Resolved
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: None
  • Fix Version/s: 0.8.2
  • Component/s: None
  • Labels:
    None
  • Number of attachments :
    0

Description

It'd be nice to have convenient shortcuts to interfaces, like how C# 2.0 allows int? to be INullable<int>.
In that vein, I propose:

T? to be equivalent to INullable of T
T* to be equivalent to IEnumerable of T
T! to be equivalent to ICantBeNullable of T

Granted, the last isn't a real interface, but it would be quite helpful.

Issue Links

Activity

Hide
Christopher Osborn added a comment -

I forgot to mention that this largely affects Metaboo, or any Boo that runs on .NET 2.0.

(My first JIRA and I flutz it...)

Show
Christopher Osborn added a comment - I forgot to mention that this largely affects Metaboo, or any Boo that runs on .NET 2.0. (My first JIRA and I flutz it...)
Hide
Rodrigo B. de Oliveira added a comment -

I specially like the T*.

Show
Rodrigo B. de Oliveira added a comment - I specially like the T*.
Hide
Bill Wood added a comment -

How about T+ for IEnumerable of T with at least one item?

Show
Bill Wood added a comment - How about T+ for IEnumerable of T with at least one item?
Hide
Christopher Osborn added a comment -

Well, I'm getting T* from Cw (Comega), T? from C# 2.0 and Cw, and T! from Spec#.

Personally, I think that's needlessly complicated, and the type system already handles the difference between empty and non-empty lists gracefully.

I just realized that with the deep unpack operator "->", Boo would handle T* more gracefully than Cw. In Cw, the dot operator is used for both getting members of the stream and getting a stream of the members of the items in the stream. This leads to ambiguity with even common members like Length. With ->, the dot can always mean the members of IEnumerable of T.

Show
Christopher Osborn added a comment - Well, I'm getting T* from Cw (Comega), T? from C# 2.0 and Cw, and T! from Spec#. Personally, I think that's needlessly complicated, and the type system already handles the difference between empty and non-empty lists gracefully. I just realized that with the deep unpack operator "->", Boo would handle T* more gracefully than Cw. In Cw, the dot operator is used for both getting members of the stream and getting a stream of the members of the items in the stream. This leads to ambiguity with even common members like Length. With ->, the dot can always mean the members of IEnumerable of T.
Hide
Cameron Kenneth Knight added a comment -

or it could be done just as well with

from item in list select item.Length

or (with more of a VB syntax)

select item.Length from item in list

The second seems more natural to me.
The first wuld technically be better for code completion.

Show
Cameron Kenneth Knight added a comment - or it could be done just as well with from item in list select item.Length or (with more of a VB syntax) select item.Length from item in list The second seems more natural to me. The first wuld technically be better for code completion.
Hide
Christopher Osborn added a comment -

Or it could be done just as well with:

list->Length

Shouldn't SQL/LINQ syntax be implemented as a macro, like C# does it?

Show
Christopher Osborn added a comment - Or it could be done just as well with: list->Length Shouldn't SQL/LINQ syntax be implemented as a macro, like C# does it?
Hide
Cedric Vivier added a comment -

Closing this issue since we now have the shortcuts for nullables and ienumerable.
Non-null type is more than a 'shortcut' and I've opened an issue specific for it : BOO-1000

Show
Cedric Vivier added a comment - Closing this issue since we now have the shortcuts for nullables and ienumerable. Non-null type is more than a 'shortcut' and I've opened an issue specific for it : BOO-1000

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: