log verbosity levels are stupid
because when should you use any log level other than
error
,warn
, orinfo
?use severities instead of verbosities
and there is really no need for anything lower, because guess what:
debug
andtrace
andDisplay
andVerbose
andVeryVerbose
and what have you - they’re all just moreinfo
for you
tracing is better than logging
I also imagine visualizing traces live in your CLI could yield a very nice user experience, with a visible progress indicator as to what eg. your compiler is working on right now at a glance, reassuring you that it is not stuck on some
while (true) {}
in constant evaluation
don’t use
RefCell<T>
using
RefCell
has a few disadvantagessecond, your program can now panic in unexpected places, because it turns out runtime borrows can be really hard to predict
as evidenced by a random crash I once got while using druid which was caused by a overlapping mutable then immutable borrows at runtime
fourth, and this one is extremely easy to spot - your code becomes really verbose!
and you end up with lots of temporaries because of the
Ref<'b, T>
guards you have to keep in scope.
operator overloading is good, but getters and setters are not
I’ll start by prefacing that I think operator overloading is good iff it’s implemented in a way that a single operator has only one, well-defined meaning
this means
+
really means addition and nothing else.the way I’d like to do it in my dream language is by a few means
(+)
is defined to be a polymorphic operator which calls into a module implementing theAddSub
interface, which means you have to implement both addition and subtraction for(+)
to work on your typerokugo let AddSub = interface { type T fun add (a : T) (b : T) : T fun subtract (a : T) (b : T) : T }
fun (+) (a : let T) (b : T) : T use AS : AddSub with { T } = AS.add a b
so now getters and setters: what’s so bad about them?
not to mention all the infinite recursion annoyance that sometimes happens when implementing them manually
this is less of a problem in languages that feature automatic generation of getters and setters - such as Kotlin
kotlin var someVariable: String get private set // no infinite recursion to be seen here!
but it’s still an issue in eg. JavaScript, where one mistake can send your call stack down the spiral:javascript class Example { #someVariable = "";
get someVariable() { return this.someVariable; } // typo!!!! set someVariable(value) { this.someVariable = value; } // typo again!!!!!!!!!! dammit! }
and the error is not caught until runtime.