128 karma · joined Aug 15, 2011 (15y ago) · 51 submissions
comment 4y ago · link · parent
comment 5y ago · link · parent
It then turned out that they could be used to simulate extension methods, which is probably the main use case for implicit classes in Scala2.
And implicit parameters were probably just the result of trying to make type classes modular.
The CanBuildFrom approach came later than implicit parameters (https://stackoverflow.com/questions/1722726/is-the-scala-2-8...).
comment 5y ago · link · parent
See slide 13: https://www.slideshare.net/Odersky/preparing-for-scala-3#13
With scala 3, syntax has been simplified even more, e.g.:
No more braces necessary. Top level declarations. Extension Methods.
comment 5y ago · link · parent
The lack of generics is the reason for a lack of many useful libraries that I miss when writing applications in Go.
Things I missed lately: Sets, maps with arbitrary keys, lists, sorting, removing duplicates, priority queues, parser combinators, list transformation functions (map, filter), transactions.
Some of these exist for Go, but with awkward APIs.
comment 5y ago · link · parent
- Vectors, matrices
- Immutable containers (lists, sets, maps, etc.)
- Domain specific languages (regular expressions, constraint languages, etc.)
And without good support for matrices, the data science and ML people will just use Python instead of Java to build their libraries. And then everyone will use the language with the best libraries, even if they don't use matrix math in their code.
For regular expressions, you have to use a DSL embedded in Strings in Java instead of using operators like | as operator on regular expressions directly.
comment 6y ago · link · parent
comment 6y ago · link · parent
* Installed VScode. The terminal in VScode was in a different environment from the system terminal, so used different Python environments. Took me a while to figure out why installing a package was not working. * Installed Slack. When I click a link in Slack it opens a new Firefox process that does not have access to my normal profile, saved logins, etc. and is not shown as a Firefox window in the sidebar.
In both cases I uninstalled the Slack version and installed the "real" version.
comment 6y ago · link · parent
Basically, we have to stop 2/3 of infections to get an R<1. If 2/3 of the population use the app honestly and we keep up some other measures (no indoor events where people are in close contact, wearing masks while shopping, no visitors in nursing homes and hospitals, etc.) then this might be enough to contain the virus until we have a vaccine.
comment 7y ago · link · parent
That would imply that the same function signature could produce different type checking results at the call site. That is something I find extremely frustrating as you can no longer reason about type checking locally.
comment 7y ago · link · parent
public void readString(String data) throws IOException {
int lastIdx = 0;
for (int idx = data.indexOf('\n'); idx > -1; idx = data.indexOf('\n', lastIdx)) {
parseLine(subSequenceView(data, lastIdx, idx));
lastIdx = idx + 1;
}
parseLine(subSequenceView(data, lastIdx, data.length()));
}
CharSequence subSequenceView(CharSequence base, int beginIndex, int endIndex) {
return new StringView(base, beginIndex, endIndex - beginIndex);
}
static class StringView implements CharSequence {
final CharSequence base;
final int offset;
final int length;
StringView(CharSequence base, int offset, int length) {
if (length < 0) throw new IllegalArgumentException("length must be >= 0");
this.base = base;
this.offset = offset;
this.length = length;
}
@Override
public char charAt(int n) {
if (n < 0 || n >= length)
throw new IndexOutOfBoundsException(n);
return base.charAt(offset + n);
}
@Override
public int length() {
return length;
}
@Override
public CharSequence subSequence(int beginIndex, int endIndex) {
return new StringView(base, offset + beginIndex, endIndex - beginIndex);
}
}comment 8y ago · link · parent
> Definitions went on for pages, followed by theorems whose statements were similarly long, but whose proofs only said, essentially, “this follows immediately from the definitions.”
This sounds perfect for machine checked proofs, but I guess the proofs are actually a lot more involved than they are presented.
comment 9y ago · link · parent
HEADLINE: fix smart autohide of unity launcher
DESCRIPTION: it is really annoying that the launcher does not appear sometimes, when moving the cursor to the edge of the screen. There are several bug reports for this issue, which are open for a long time.
In general I would love to have a way to pay an Ubuntu dev to fix a specific bug.
comment 12y ago · link · parent
Promise A E -> (A -> A') -> (E -> E') -> Promise A' E'
That would eliminate some strange corner cases and make it easier to explain the function. The special cases could just get their own functions. Real algebraic data types would probably eliminate the need for E entirely and make it even simpler.
comment 12y ago · link · parent
A wiki with some nice explanations of design principles.