Inconsistent printing of old `immutable`s and new `struct`s

In v0.5-, instances of immutables (and regular types) print without spaces after commas.

julia> immutable Point
           x::Int
           y::Int
       end

julia> Point(3,4)
Point(3,4)

I noticed, though, that the new structs use a space after the comma.

julia> struct Point
           x::Int
           y::Int
       end

julia> Point(3,4)
Point(3, 4)

It doesn’t seem like the most important issue, by far, but I’m curious - is this intentional? :slight_smile:

(On a slightly broader note, what is the recommended style for Julian commas? To space or not to space?)

There has been a general tendency towards adding whitespace for readability and clarity, as shown by your post.

1 Like

i personally don’t like such “hard coded” rules. my suggesttion: use whatever is more clear, when in doubt, use space.

I believe this was changed here. I think the trend has been towards more spaces.

1 Like

It matches a spacing convention that’s seen in Base. In that sense, it makes everything look more like the code that generated it, if using that spacing convention.

2 Likes

I think spaces after commas are better, and would prefer Julia to use them consistently for output. However, perhaps they shouldn’t be required when Julia code is being parsed.

I’ve often wondered whether commas without spaces cause confusion for people in European countries, who use commas instead of decimal point separators. So for me “3,4” is 2 numbers, but only one for them.

1 Like

Interesting. Glad to see more consistency here. Thanks, everyone. :slight_smile: