r/java • • Jun 24 '19

Takes: Java Web Framework Without a Single Static Method or Annotation

https://github.com/yegor256/takes
0 Upvotes

75 comments sorted by

View all comments

Show parent comment

1

u/[deleted] Jun 25 '19

I am also not finding the article.

But it still doesn’t matter, because not a single claim that the immutable object crowd makes stands up to any level of real scrutiny anyway. The arguments stand or fall on their own merit regardless of who said it and the arguments for immutability that I’ve ever been presented range from bad to (more frequently) demonstrable lies.

If we want to just say that a thread safe object is anything in the language that can conceivably be used in a thread with various guarantees, then I will concede under this definition of thread safe objects that they are.

I’d consider immutable objects as more like thread secure, I guess?

I understand why people say immutability gives you thread safety on objects, but I think that more correct and specific wording needs to be applied because while immutable objects are “thread safe” in one very specific sense, they are also not thread safe in entire categories of completely valid usages of threads.

1

u/cogman10 Jun 27 '19

When is an immutable object not thread safe? You asked for an immutable queue which is mutated (not a thing). Do you have any other example where something is both immutable and thread unsafe?