You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We currently spell sequence, dictionary and the proposed result in lowercase, like most other keywords.
I propose to use instead Pascal case for these keywords: Sequence, Dictionary and Result.
Rationale
In many languages, including Slice, type names--including generic type names--are Pascal case. Sequence and Dictionary can be used as types, and syntactically Result is used as a return type. Pascal case is the expected capitalization for this usage in Slice.
Note that in Ice, sequence and dictionary could not be used as types. They were more like struct, with:
// Old slice
struct Point { int x; int y; }
sequence<Point> PointSeq; // sequence is used as "struct" here, to build a new constructed type
The text was updated successfully, but these errors were encountered:
I'm fine with any kind of capitalization, we should just pick one and be consistent about it.
Buttt, to play devil's advocate, I've always felt the rationale is that keywords should be lowercase and constructed types should be PascalCase. It just so happens that in many languages dictionary and sequence types are backed by constructed types: Sequence, HashMap, IDictionary, Vec, IList, etc.
So I'd bet good money that if C# were to add a keyword version for List, it would be lowercase.
Take Java for example, which has both:
int a primitive type that is specified by a keyword (and hence lowercase)
Integer a constructed type (and hence PascalCase)
Or far interestingly, Rust. One of the core types in Rust is Box. It's used to store data on the heap.
In old Rust, it was so special that it was given a keyword:
let x = ...;
let boxed = box x;
But after some time, they changed their mind and made Box a normal constructed type like anything else:
let x = ...;
let boxed = Box::new(x);
When it was a keyword, they used lowercase, when they made it a constructed type they used PascalCase.
The issue where they phased out the old keyword version: rust-lang/rust#49733
While it's true that keywords are usually lowercase, it's not a strict rule. For keywords used as special type names, it's arguably common to see them in Pascal case.
Take Self in Rust, or Any, Protocol, Self and Type in Swift.
With your example, the old box didn't use a normal type syntax. We use the "normal" type reference syntax for Dictionary etc. (putting aside the non-standard <...>).
Another advantage of changing the spelling of these keywords is you can more easily use them as parameter names and field names, per the usual Slice naming conventions:
op(sequence: Sequence<int32>) // doesn't work without escaping if sequence is keyword
We currently spell
sequence
,dictionary
and the proposedresult
in lowercase, like most other keywords.I propose to use instead Pascal case for these keywords: Sequence, Dictionary and Result.
Rationale
In many languages, including Slice, type names--including generic type names--are Pascal case. Sequence and Dictionary can be used as types, and syntactically Result is used as a return type. Pascal case is the expected capitalization for this usage in Slice.
Note that in Ice, sequence and dictionary could not be used as types. They were more like
struct
, with:The text was updated successfully, but these errors were encountered: