Scala-native: Rename scalanative.native to scalanative.unsafe

Created on 21 Mar 2018  路  6Comments  路  Source: scala-native/scala-native

  1. motivation:
    scala-native uses packages names, such as scala.scalanative.native:
    https://github.com/scala-native/scala-native/tree/master/nativelib/src/main/scala/scala/scalanative/native
    which contains java reserved keywords, such as native,
    which results in various problems in Scala IDE,
    including inability to view class files from such packages

  2. a solution could be just to rename such packages,
    i.e. native -> nativelib, instead of fighting various IDEs

  3. the word native itself is heavily overused and overloaded
    perhaps scala.scalanative.clang or scala.scalanative.interop are more descriptive terms

interop

Most helpful comment

A better name alternative: unsafe. Short. Clear that you can cut yourself. Mirrors what other languages are calling it.

All 6 comments

The scala.scalanative.native is intentional and mimicks scala.scalajs.js. It's our main entry point to the user-facing interoperability APIs. Changing it will break every single Scala Native project that interacts with C libraries. It's a bit too late for this kind of change.

  1. :-) then proper mapping should be:
    scala.scalajs.js -> scala.scalan.n

  2. the sooner the break the better:

  3. it is still a long long way to v 1.0
  4. scala-native universe is still rather small
  5. does scala-native really need to play a role of IDE police

@densh I guess @Andrei-Pozolotin is technically correct about package naming restrictions. I'm not sure a change now would be the worst thing but I haven't published anything yet. I would think most of the user facing libs are Scala cross projects. We could look on scaladex https://index.scala-lang.org/search?q=*&targetTypes=Native for those with native components.
https://docs.oracle.com/javase/tutorial/java/package/namingpkgs.html
https://docs.oracle.com/javase/tutorial/java/nutsandbolts/_keywords.html

more native + Scala IDE fun:

import scala.scalanative.native.time._
Error: object time is not a member of package scala.scalanative.native Note: class time exists, but it has no companion object.

A better name alternative: unsafe. Short. Clear that you can cut yourself. Mirrors what other languages are calling it.

thank you

Was this page helpful?
0 / 5 - 0 ratings