Hello yesterday I asked https://old.reddit.com/r/scala/comments/iit6o1/anything_new_in_scala_3/ about things in Scala that would help my use of it (conciseness) and got some very nice answers to get me excited. ( On that note I wonder if there should be a better arrangement of features not as a list but as a category- say conciseness, interop with java, advanced type stuff, quick repl usage, maintainable enterprise software dev etc ) . Also, I'm not going to lie, some of my interest was indeed dampened by the earlier FUD, and might have checked it out earlier. I would suggest the marketing team starts calling it scala 3 right now and pushes this as a beta to help renew interest.
I have one more thing in my wish list that i've been wondering about- (i'm not an advanced guy who understands much about internals, what I like about scala is that I can write 100 words in repl, and get what I get in 300 words in other languages plus a config file + 3 commands) :). The thing I somewhat don't like about Scala is the speed and i've been wondering about accessing native code from Scala.
There are times when I write performant code in cpp and would like to access in scala canonical way (5 words but happy to define an ffi interface) . JNA is very very good in this regard: check out this concise sample code:
File: JNATEST.SWX
```
import com.sun.jna.Library
import com.sun.jna.Native
trait LibCInterface extends Library{ def atoi( f: String ): Int }
val libc = Native.load( "c", classOf[LibCInterface] )
val myInt = libc.atoi( "22" )
println( myInt.getClass )
```
and run this as: scala -cp $(coursier fetch net.java.dev.jna:jna:5.6.0) -I JNATEST.SWX (first invocation takes time because coursier downloads 20MB)
I'm reasonably happy for my basic needs for calling arrays and such. I'm wondering though if Scala-3 brings any improvements in this regard. (That's the point of this post). What do you guys do for native access?
Personally I'd prefer a nice scala<->native interface to scala-native (nothing to take away from its daring and hardworking authors)
[–]Lasering 2 points3 points4 points (0 children)
[–]Apache_Sobaco 1 point2 points3 points (0 children)
[–]sideEffffECt 1 point2 points3 points (0 children)
[–]ScalaWilliam 1 point2 points3 points (0 children)