History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: BOO-619
Type: Wish Wish
Status: Resolved Resolved
Resolution: Fixed
Priority: Minor Minor
Assignee: Cedric Vivier
Reporter: Christopher Osborn
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Boo

Shortcuts to interfaces

Created: 21/Nov/05 05:55 PM   Updated: 01/May/08 08:56 AM
Component/s: None
Affects Version/s: None
Fix Version/s: 0.8.2

Time Tracking:
Not Specified

Issue Links:
Duplicate
 
Related
 
Supercedes
 


 Description  « Hide
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.



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Christopher Osborn - 21/Nov/05 05:57 PM
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...)


Rodrigo B. de Oliveira - 22/Nov/05 12:08 PM
I specially like the T*.

Bill Wood - 22/Nov/05 12:38 PM
How about T+ for IEnumerable of T with at least one item?

Christopher Osborn - 22/Nov/05 01:16 PM
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.


Cameron Kenneth Knight - 22/Nov/05 05:48 PM
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.


Christopher Osborn - 23/Nov/05 02:46 PM
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?


Cedric Vivier - 01/May/08 08:56 AM
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