From: shevegen@... Date: 2019-08-10T22:40:42+00:00 Subject: [ruby-core:94259] [Ruby master Feature#16095] 2 Features: remove (simplify) 'new' keyword and Property Shorthand Issue #16095 has been updated by shevegen (Robert A. Heiler). The net-gain from removing .new would be quite minimal. I also think it is less readable too, but even well aside from this, this seems to be backwards incompatible and may have to require a long transition time if it is possible to add. I am also not sure whether matz would want to have this - IMO there are too many drawbacks associated with the change, with the net benefit of writing shorter code being a very minimal advantage, if it is one at all. Property Shorthand was discussed before; matz responded back then. I believe what he wrote back then still applies. (I don't remember offhand but I think one comment from matz was to wait and see; I think that was in regards to javascript and how they use their shorthand variant.) It may be better to add to the discussion at #15192 if you feel strongly about shorthand syntax. As for other syntax such as: :arg1, ^arg1, %arg1, ...) I think some of them are problematic. First one is symbol - I think people would not expect a symbol to behave as a shortcut syntax in this context. But either way I think it is best to discuss this at #15192, IMO. ---------------------------------------- Feature #16095: 2 Features: remove (simplify) 'new' keyword and Property Shorthand https://bugs.ruby-lang.org/issues/16095#change-80574 * Author: D1mon (Dim F) * Status: Open * Priority: Normal * Assignee: * Target version: ---------------------------------------- **common use:** ``` ruby class A def initialize(arg1, arg2) @arg1 = arg1 @arg2 = arg2 end end A.new(1,2) ``` 1) feature: remove 'new' keyword: ``` ruby A(1,2) # shorter and more comfortable ``` 2) feature: Property Shorthand (like ES6) ``` ruby class A def initialize(arg1, arg2) # shorter and more comfortable @arg1, @arg2 # or this: @arg1 @arg2 end end ``` So as not to duplicate the code (words). May need to do some other syntax or character (:arg1, \^arg1, %arg1, ...) can also be applied to other types. Hash example: ``` ruby a = 1 b = 2 h = {a:a,b:b} # common use h = {a,b} # new syntax or {%a,%b} - any syntax of your choice ``` -- https://bugs.ruby-lang.org/ Unsubscribe: