General

Profile

wied03 (Brady Wied)

  • Login: wied03
  • Registered on: 04/30/2016
  • Last sign in: 04/30/2016

Issues

open closed Total
Assigned issues 0 0 0
Reported issues 1 0 1

Activity

05/19/2016

11:04 PM Ruby Feature #12334: Final/Readonly Support for Fields / Instance Variables
Daniel: It might be easiest to go read about how readonly works in C#.
This is quite different than a constant because it can very with each instance of an object since a "readonly ivar" is set in the initializer.
Private methods a...
wied03 (Brady Wied)

05/02/2016

03:56 PM Ruby Feature #12334: Final/Readonly Support for Fields / Instance Variables
I know that it has nothing to do with freezing. I was just using that as an example of something where Ruby has decided to give the developer a tool to control mutation.
@Tsuyoshi - Yes a constant like that is sort of what I'm describ...
wied03 (Brady Wied)
02:54 PM Ruby Feature #12334: Final/Readonly Support for Fields / Instance Variables
If the developer had to take care of all of this, we probably would not have freezing right? You could make the case that it should be up to the developer to not mutate a frozen object. I'm not sure what the exact thought process was beh... wied03 (Brady Wied)
02:51 PM Ruby Feature #12334: Final/Readonly Support for Fields / Instance Variables
Maybe leaving it to the developer or design/code reviewing is the best way. I do think there is something to the idea of controlled mutation though. It's a good middle ground between what the functional language people are pushing for (t... wied03 (Brady Wied)
02:21 AM Ruby Feature #12334: Final/Readonly Support for Fields / Instance Variables
If the feature should be rejected, I can live with that, but I don't think we had the same idea of what I was requesting here. wied03 (Brady Wied)
02:20 AM Ruby Feature #12334: Final/Readonly Support for Fields / Instance Variables
Here is an example:
~~~ruby
class Foo
attr_reader :foo
def initialize
@foo = 123
end
def accidental_mutate
@foo = 456 # Ruby doesn't give me any way to prevent this as of now
end
end
class Foo
attr...
wied03 (Brady Wied)
02:15 AM Ruby Feature #12334: Final/Readonly Support for Fields / Instance Variables
This feature request is not about being external to the object.
I can have multiple Ruby methods in the same class besides the initialize method that all do @some_ivar = 123 or @some_ivar=456. This is about trying to guard against th...
wied03 (Brady Wied)

05/01/2016

04:38 PM Ruby Feature #12334: Final/Readonly Support for Fields / Instance Variables
Sorry, I should have used correct terminology. By fields, I meant instance variables. wied03 (Brady Wied)

04/30/2016

06:28 PM Ruby Feature #12334 (Open): Final/Readonly Support for Fields / Instance Variables
This sort of relates to https://bugs.ruby-lang.org/issues/11911
C# through 'readonly' and Java through 'final' variables/fields allow me to only allow assigning a field in the initializer. It might be nice to embrace some controlled m...
wied03 (Brady Wied)

Also available in: Atom