score:3
Accepted answer
You're correct: functional-looking code can be rendered non-functional when used by multiple threads if it uses internal state as part of its implementation. You can fix this by synchronizing every method that touches the mutable variables (i.e. with a synchronized
block). Unfortunately, this is not ideal for performance, which is why in a threaded application functional implementations are often preferred.
Source: stackoverflow.com
Related Query
- Functional Queue From Programming In Scala
- Functional Programming in Scala book: How to run the inline examples from chapter 9?
- To which language is Scala most similar from a functional programming perspective?
- How to extract immutable from Map(String, List(String)) list using Functional programming in scala
- Difference between reduce and foldLeft/fold in functional programming (particularly Scala and Scala APIs)?
- Functional Reactive Programming in Scala
- Is Scala functional programming slower than traditional coding?
- Real World Functional Programming in Scala
- Is Scala a Functional Programming Language?
- Scala String Equality Question from Programming Interview
- Generate a DAG from a poset using stricly functional programming
- Scala functional programming gymnastics
- How to enforce Functional Programming on Scala
- An example of functional programming in scala
- Coursera - Functional Programming Principles in Scala - can't work with example project because of errors
- Functional programming in scala - infinite streams
- Generic programming & Rotten Bananas in Scala involving functional dependencies
- How to rewrite this code in Scala using a Functional Programming approach
- What is a combinator in Scala or functional programming
- Writing elements to a file as they are dequeued from the queue : Scala fs2 Stream
- Functional Programming scala
- Need help to refactor this scala method in functional programming style
- Functional way to create a union of all keys from a Seq of Maps in Scala
- scala's traits and super examples from Programming in Scala 2nd ed
- Functional Programming in Scala - Building the Option Type
- Scala way of merging tuples in a list using functional programming techniques
- Scala Functional Programming Generics
- How to create a List of Lists in Scala in functional programming style
- How to manage DB connection in Scala using functional programming style?
- Functional Programming exercise with Scala
More Query from same tag
- Boolean logic in Future[Boolean]
- Get item before filter match
- From Play! to Scalatra, templating headaches, directory structures
- Manually retrieving Ivy dependencies as locally unmanaged libs in sbt
- Spark doesn't seem to call hasNext when iterating through RDD iterators and a limit is applied
- When a keyword means different things in different contexts, is that an example of context sensitivity?
- Kafka 8.2.0 on Scala 2.10/Windows - Could not find or load main class org.apache.zookeeper.server.quorum.QuorumPeerMain
- Scala http library for google app engine : scalaj-http vs dispatch vs?
- sub Window panel into canvas scene with javafx
- How to correctly handle individual exceptions in Future.sequence?
- How to disable checksum checks in SBT with new coursier integration
- How to compute a cumulative sum under a limit with Spark?
- How to test composition of futures inside a receive method of actor?
- Calling a Scala program from command line
- Scala Play: Invalid '@' symbol in email regex
- Storing data in HBase using Spark
- Spray MultipartFormData Spec
- Scala - How do I do an "assertThrows" method?
- Pimp my library on Joda LocalDate does not work
- What's the purpose of Function.const?
- accessing elements of a lift-json parsed object in scala
- Is it possible to pass dynamic values in default replacement of ZipAll in Scala?
- How can I put a Class into Scope of a JJS ScriptEngine in Scala
- How to get Java like PID in scala
- Loading a JNI library in scala
- EBean with Scala on SBT (InterruptedException: sleep interrupted)
- Using Refined for Retry?
- Creating an instance of the self type in Scala
- Scala Stream/Iterator that Generates Excel Column Names?
- SQL queries in Spark/scala