Comments (8)
Incomplete list (feel free to add more):
-
assert
: This one is ok and doesn't need to be changed. -
{Long,Int,Byte}#div
: Keep as-is. -
{Long,Int}#toChar
: Migrate to Option? -
String#{fromBytesPartOrNull,fromStringPartOrNull}
: Probably going away. -
Array#get
: Keep as-is. -
Array#set
: Keep as-is.
from dora.
Agreed, however I wouldn't change the return type for Array#get
and Array#set
to Option[T]
. Additional methods that return an Option would be great though. At the moment those methods aren't declared throws either, it would just be too much boilerplate for array-heavy code without too much added value (most of the time folks would just write array(idx).unwrap()
anyways. Following this logic even operations like a / b
would have to return an option to handle div-by-0.
from dora.
I wouldn't change the return type for Array#get and Array#set to Option[T].
My hope would be that we would have a rich enough iterator/collections/streaming API one day, that we would look back on this and say "the alternatives are so good and popular, changing get/set to not throw would have minimal impact".
Also, having the array operations as Option
would actually be more regular with other collection's lookup operations like Set#get
or Map#get
.
But I think we should keep it as-is, because there is still a long way to go before this can even be considered.
At the moment those methods aren't declared throws either, it would just be too much boilerplate for array-heavy code without too much added value [...]
Totally agree!
Following this logic even operations like a / b would have to return an option to handle div-by-0.
Agreed, I have been thinking about this some time ago and how it can be dealt with without introducing lots of boilerplate.
from dora.
Agreed, let's revisit this later.
from dora.
I think the remaining ones are easily identified due to the mandatory throws
keyword, or are there any other exceptions like for arrays that you can think of?
from dora.
None that I remember right now.
from dora.
Great, thanks!
from dora.
I documented the existing (assumed public-facing) cases, I think this can be closed for now.
from dora.
Related Issues (20)
- Unified Condition Expressions HOT 1
- panic: enum value and `is` HOT 3
- Extending the reach of enums HOT 1
- `toStringHex` and `toStringBinary` strip off leading zeros HOT 1
- Consider turning asserts in @test annotated methods into soft asserts
- Allow defining and calling methods without parentheses
- `--emit-ast` doesn't do anything HOT 2
- The JIT implementation of dora is very cool HOT 1
- reinstate class syntax
- replace `fn` keyword with `fun` keyword
- reinstate `=` for function definition
- implement named parameters
- implement string hash caching
- implement definitional enums
- implement modules (singletons and holders of static functions)
- remove unary operators
- remove bitshift operators
- implement unified condition expressions
- replace procedure syntax with functions having return type `Unit` HOT 1
- How lazy compilation is protected in case of multiple threads? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dora.