immutability Questions

10

Solved

Is there a better way of doing this... MyString.Trim().Replace("&", "and").Replace(",", "").Replace(" ", " ") .Replace(" ", "-").Replace("'", "").Replace("/", "").ToLower(); I've extended ...
Dichasium asked 24/8, 2009 at 9:25

3

Solved

[NOTE: I asked this question based on an older version of Rakudo. As explained in the accepted answer, the confusing output was the result of Rakudo bugs, which have now been resolved. I've left th...
Polypary asked 18/9, 2021 at 4:10

3

Solved

Is there a simple way to create an immutable NumPy array? If one has to derive a class from ndarray to do this, what's the minimum set of methods that one has to override to achieve immutability? ...
Adjective asked 4/4, 2011 at 16:18

17

Solved

I am using Redux. In my reducer I'm trying to remove a property from an object like this: const state = { a: '1', b: '2', c: { x: '42', y: '43' }, } And I want to have something like this ...
Simonne asked 21/12, 2015 at 17:18

8

Solved

I know that value types should be immutable, but that's just a suggestion, not a rule, right? So why can't I do something like this: struct MyStruct { public string Name { get; set; } } public ...
Lenard asked 13/4, 2011 at 14:15

4

I am new to Functional programming. The challenge I have is regarding the mental map of how a binary search tree works in Haskell. In other programs (C,C++) we have something called root. We store...

2

Solved

Every time I emit a message from another component, I can't get the full list of messages. Here is the hook and view component: export function useChat() { const [messages, setMessages] = useStat...
Afreet asked 13/2, 2019 at 16:53

2

Solved

So I started learning React a week ago and I inevitably got to the problem of state and how components are supposed to communicate with the rest of the app. I searched around and Redux seems to be ...
Joerg asked 29/10, 2015 at 20:38

3

Solved

I have a domain class Person annotated with Lombok @Value thus marking it as immutable, having has 3 fields. In my service layer, I am making a call to the repository to check if the the person exi...
Wording asked 9/12, 2021 at 20:32

1

Solved

In PHP 8.1, the readonly keyword is now available. I am curious about its purpose. Is it intended to assist the editor in recognizing that a property is solely readonly, to aid the client in unders...
Empire asked 6/12, 2021 at 10:11

7

I have a class in C# that contains a Dictionary, which I want to create and ensure nothing as added, edited or removed from this dictionary as long as the class which contains it exists. readonly ...
Rollin asked 12/5, 2009 at 16:51

5

Solved

Currently trying to understand the "^" operator in Elixir. From the website: The pin operator ^ can be used when there is no interest in rebinding a variable but rather in matching against its ...

10

Solved

What's a good and short way to remove a value from an object at a specific key without mutating the original object? I'd like to do something like: let o = {firstname: 'Jane', lastname: 'Doe'}; l...
Disconformity asked 10/10, 2015 at 11:9

15

Solved

Is there an immutable alternative to the primitive arrays in Java? Making a primitive array final doesn't actually prevent one from doing something like final int[] array = new int[] {0, 1, 2, 3};...
Cathey asked 13/9, 2010 at 13:43

5

*Hi all, I have an easy question for you all. I have an RDD, created from kafka streaming using createStream method. Now i want to add a timestamp as a value to this rdd before converting in to d...
Beamy asked 9/1, 2017 at 8:58

9

Solved

I need a small Container-Class for storing some Strings which should be immutable. As String itself is an immutable type, I thought of something like that: public final class Immu { public final ...
Egidius asked 3/8, 2011 at 14:5

2

Solved

I am new to F# and I noticed that arrays are still mutable. Is this because of the performance implications or because the inherent .NET CLR type system? I am aware that immutable lists do exist. T...
Sectionalize asked 29/8, 2021 at 11:40

7

Solved

I learned that if a variable is not explicitly declared mutable using mut, it becomes immutable (it cannot be changed after declaration). Then why do we have the const keyword in Rust? Aren't they ...
Mucus asked 17/6, 2016 at 9:3

5

Is it possible to use AutoMapper with Immutable types? For example my Domain type is immutable and I want to map my view type to this. I believe it is not but just want this confirmed. Also as i...
Slacker asked 3/2, 2010 at 21:44

7

Solved

From Java 1.6 Collection Framework documentation: Collections that do not support any modification operations (such as add, remove and clear) are referred to as unmodifiable. [...] Collections tha...
Choiseul asked 10/10, 2011 at 13:12

12

Solved

Having a friendly debate with a co-worker about this. We have some thoughts about this, but wondering what the SO crowd thinks about this?
Julide asked 14/1, 2009 at 16:35

1

Solved

[EDIT: closed in favor of https://mcmap.net/q/1507233/-what-are-the-rules-for-re-binding, which I formulated after more clearly understanding what I was trying to ask in this question.] My un...
Gastroenterostomy asked 3/9, 2021 at 18:51

1

Solved

I am trying to create an index for text search in Postgres, but I keep getting an error when I create generated tsvector column. ERROR: generation expression is not immutable SQL state: 42P17 I ha...
Keri asked 10/8, 2021 at 18:23

4

While frozendict was rejected, a related class types.MappingProxyType was added to public API in python 3.3. I understand MappingProxyType is just a wrapper around the underlying dict, but despite...
Pietism asked 22/1, 2017 at 19:16

3

Solved

I want to create an array. I don't need the array to be mutable, and at the time of creation, I have all the information I need to calculate the i-th member of the array. However, can't figure out ...
Anisometric asked 18/10, 2014 at 0:9

© 2022 - 2024 — McMap. All rights reserved.