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

Key: BOO-818
Type: Improvement Improvement
Status: Resolved Resolved
Resolution: Fixed
Priority: Minor Minor
Assignee: Cedric Vivier
Reporter: Cedric Vivier
Votes: 0
Watchers: 0
Operations

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

Shorthand syntax for Nullable of T, like T? in C#.

Created: 30/Apr/07 04:07 AM   Updated: 06/Apr/08 08:51 AM
Component/s: Parser, Compiler
Affects Version/s: None
Fix Version/s: 0.8.2

Time Tracking:
Not Specified

Issue Links:
Related
 


 Description  « Hide
Here's the JIRA discussion about Avish suggestion.

If approved we would get a shortcut syntax as in C# to declare nullable types.

Example:
x = int?

instead of :
x = Nullable of int



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Marcus Griep - 29/Oct/07 10:20 PM
For generic structs, the '?' should come before the generic parameters as in:
x = test? of int
x = tester?[of test? of int, char]

Otherwise the following code becomes ambiguous (possibilities in comments):

x = test of int?
// x = test[of int?]
// x = test[of int]?

Rodrigo B. de Oliveira - 30/Oct/07 04:52 AM
x = test of int?

should always means:

x = test[of int?]

Disambiguation should be done through [] as in:

x = test[of int]?

Marcus Griep - 30/Oct/07 08:22 AM
Would you then prefer the '?' to be after generic parameters rather than before?
x = test? of int
x = test[of int]?

Cedric Vivier - 02/Apr/08 08:43 AM
Since we have discussed about removing syntax without brackets for 0.9 (constraints...) the choices are clearer :

1) x = test?[of int]

or

2) x = test[of int]?

I also have a preference for (1) since imho "nested nullables" looks clearer with it, compare :

(1) x = test?[of int?]

against

(2) x = test[of int?]?

Marcus I'm willing to work on this soon along with BOO-805 / BOO-807 , so would you mind reassigning the task to myself?


Marcus Griep - 02/Apr/08 11:55 AM
I would not have a problem with you taking a couple issues. I haven't gotten around to this one, so its better to get this one rolling.

Rodrigo B. de Oliveira - 02/Apr/08 12:03 PM
For consistency, the '?' should always come after the type reference.
x = test[of int?]?

Cedric Vivier - 02/Apr/08 01:25 PM
Good point!
Consistency with C# syntax is not bad either.

Well, let's go for this syntax then.


Cedric Vivier - 06/Apr/08 08:51 AM
fixed in rev. 2897

some antl-fu is needed to re-enable ID_PREFIX '?' for brail users.