- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
Why trailing comma is deprecated?
Sat, 2009-02-28, 20:24
Why trailing comma in varargs is deprecated? It is handy:
===
val collations = Map(
"cp1256" -> "cp1256_general_ci",
"cp1257" -> "cp1257_general_ci",
...
"geostd8" -> "geostd8_general_ci",
"cp932" -> "cp932_japanese_ci",
"eucjpms" -> "eucjpms_japanese_ci",
)
===
Such lists can be long, and can change over time. It is harder to
maintain such lists, when trailing comma is not permitted:
— I have to remeber that I cannot just drop a line, and I cannot just
add a line — I have to write commas.
— Diffs contain unnecessary information when just one entry added:
===
"cp932" -> "cp932_japanese_ci",
- "eucjpms" -> "eucjpms_japanese_ci"
+ "eucjpms" -> "eucjpms_japanese_ci",
+ "armscii8" -> "armscii8_general_ci"
)
===
S.
Sat, 2009-02-28, 22:07
#2
Re: Why trailing comma is deprecated?
On Sat, Feb 28, 2009 at 22:39, Jon Buffington wrote:
> On Feb 28, 2009, at 2:24 PM, Stepan Koltsov wrote:
>
>> Why trailing comma in varargs is deprecated? It is handy:
>>
>> ===
>> val collations = Map(
>> "cp1256" -> "cp1256_general_ci",
>> "cp1257" -> "cp1257_general_ci",
>> ...
>> "geostd8" -> "geostd8_general_ci",
>> "cp932" -> "cp932_japanese_ci",
>> "eucjpms" -> "eucjpms_japanese_ci",
>> )
...
> If you are adding to the tail of the list, I find the following structure
> helpful:
>
> val collations = Map( "cp1256" -> "cp1256_general_ci"
> , "cp1257" -> "cp1257_general_ci"
> ...
> , "geostd8" -> "geostd8_general_ci"
> , "cp932" -> "cp932_japanese_ci"
> , "eucjpms" -> "eucjpms_japanese_ci"
> )
Unfortunately, it does not allow working with first element :)
S.
Sun, 2009-03-22, 03:57
#3
Re: Why trailing comma is deprecated?
On Sat, Feb 28, 2009 at 1:54 PM, Stepan Koltsov <stepan.koltsov@gmail.com> wrote:
Just ran across this thread while cleaning up my mail, and wanted to make sure:
This feature is *not* being deprecated anymore, right? The warning message in 2.7.3 is kind of annoying, since, as others pointed out, trailing commas are allowed in most other languages, and are used all over the place.
robey
On Sat, Feb 28, 2009 at 22:39, Jon Buffington <lists@jon.buffington.name> wrote:
> On Feb 28, 2009, at 2:24 PM, Stepan Koltsov wrote:
>
>> Why trailing comma in varargs is deprecated? It is handy:
>>
>> ===
>> val collations = Map(
>> "cp1256" -> "cp1256_general_ci",
>> "cp1257" -> "cp1257_general_ci",
>> ...
>> "geostd8" -> "geostd8_general_ci",
>> "cp932" -> "cp932_japanese_ci",
>> "eucjpms" -> "eucjpms_japanese_ci",
>> )
Just ran across this thread while cleaning up my mail, and wanted to make sure:
This feature is *not* being deprecated anymore, right? The warning message in 2.7.3 is kind of annoying, since, as others pointed out, trailing commas are allowed in most other languages, and are used all over the place.
robey
On Feb 28, 2009, at 2:24 PM, Stepan Koltsov wrote:
> Why trailing comma in varargs is deprecated? It is handy:
>
> ===
> val collations = Map(
> "cp1256" -> "cp1256_general_ci",
> "cp1257" -> "cp1257_general_ci",
> ...
> "geostd8" -> "geostd8_general_ci",
> "cp932" -> "cp932_japanese_ci",
> "eucjpms" -> "eucjpms_japanese_ci",
> )
> ===
>
> Such lists can be long, and can change over time. It is harder to
> maintain such lists, when trailing comma is not permitted:
>
> — I have to remeber that I cannot just drop a line, and I cannot just
> add a line — I have to write commas.
> — Diffs contain unnecessary information when just one entry added:
>
> ===
> "cp932" -> "cp932_japanese_ci",
> - "eucjpms" -> "eucjpms_japanese_ci"
> + "eucjpms" -> "eucjpms_japanese_ci",
> + "armscii8" -> "armscii8_general_ci"
> )
> ===
If you are adding to the tail of the list, I find the following
structure helpful:
val collations = Map( "cp1256" -> "cp1256_general_ci"
, "cp1257" -> "cp1257_general_ci"
...
, "geostd8" -> "geostd8_general_ci"
, "cp932" -> "cp932_japanese_ci"
, "eucjpms" -> "eucjpms_japanese_ci"
)
- Jon
>
>
> S.