Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
lkitching
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
21 ms
·
61.
▲
by
lkitching
8y ago
But the IDE's ability to tell you depends on the language. IDE features for dynamic languages are worse because the static structure of the code is not available, so usually devolves into basic string matching. In the case of C#, the l
62.
▲
by
lkitching
8y ago
Who is using gradual typing in a clojure codebase? I've never seen any usages of core.typed in the wild. Using schema is more common although its future seems uncertain in the wake of spec. In my experience schemas require just as much
63.
▲
by
lkitching
8y ago
The term 'Xennial' was coined just for people in your demographic: https://en.wikipedia.org/wiki/Xennials
64.
▲
by
lkitching
8y ago
You haven't needed Visual Studio to build .net projects for a long time, project files are MSBuild files.
65.
▲
by
lkitching
8y ago
One problem with using or is if the key is associated with false, then it will be ignored in favour of the default. Keywords support a second argument which is the default to use on not-found so you can just write: (-> {:a 1 :b 2}
66.
▲
by
lkitching
9y ago
I don't see how the tuple is better in this case since the first thing you need to do is check the flag to see if the value is valid. The tuple version then needs to be split over two lines instead of a single line like if(TryGe
67.
▲
by
lkitching
9y ago
F# has syntactic support for monads called computation expressions ( https://docs.microsoft.com/en-us/dotnet/fsharp/language-refe... ). There are a couple of these included in the standard library (seq and asyn
68.
▲
by
lkitching
9y ago
I'm not asking specifically about vectors, that's just a common example of a dependent type. To take another example from the documentation, can you express a type like type digits = RegexString (Regex "^[0-9]+$")
69.
▲
by
lkitching
9y ago
How do you express the type `Vect 3 Int` using this library? F# doesn't support it and all the example types appear to depend on other types, not on values like 3.
70.
▲
by
lkitching
9y ago
Does this library actually allow you to express dependent types or is it just for runtime validation? I can't see any examples in the documentation of a type depending on a value like the common let v : Vect 3 Int = [1,2,3] ex
71.
▲
by
lkitching
9y ago
> its about the fact you don't control an external dependency during testing If your code is structured using small static functions, you don't have any dependencies in the first place, just arguments you are passed and transfo
72.
▲
by
lkitching
9y ago
I disagree that delegates and higher-order function are 'crap' or in any way more complicated than introducing interfaces that are injected though a centralised container. You could just as easily turn that argument around and say
73.
▲
by
lkitching
9y ago
> that method is now dependent on the static class and you don't have any control over it. I don't see how you have any less control over it than any other code you wrote. If you don't want it to write log statements, then
74.
▲
by
lkitching
9y ago
I don't see why TDD requires ruling out static methods and insisting on hiding everything behind an interface. Static methods are straightforward to test, certainly more than a class with multiple dependencies which need to be mocked.
75.
▲
by
lkitching
9y ago
By the same token, tests can only verify certain properties of a function. How could you test that a function is free from side-effects? How could you test it never returns null?
76.
▲
by
lkitching
9y ago
The problem is that without knowing the type in question you don't know the values you're testing with cover all of the possible cases. When interfacing with an external dynamically-typed function this requires attempting to rever
77.
▲
by
lkitching
9y ago
It's implicit arguments, not implicit conversions that enable type classes in Scala, although the class is usually represented by a trait e.g. trait Show[T] { def show(v : T): String } implicit object ShowInt extends Show[Int
78.
▲
by
lkitching
9y ago
> Microsoft could have added some unified Unit type but they did not, which makes this irrelevant. It's not irrelevant - you're using Task/Task<T> as an example of the non-generic base type/generic subtype patte
79.
▲
by
lkitching
9y ago
> You are thinking that using reflection and casting at runtime is not a sensible thing because it is not optimal No I'm not thinking that, I'm saying that implementing a non-generic base interface like public interface I
80.
▲
by
lkitching
9y ago
The Haskell version of printf does not statically analyse the format string and will raise an exception if the provided arguments are invalid e.g. Prelude Text.Printf> printf "%d\n" "invalid" *** Exception:
81.
▲
by
lkitching
9y ago
What sensible thing could you do with a list containing a ThingValidator and OtherThingValidator? Assuming there's no relationship between Thing and OtherThing you're forced to use runtime checking to find the validator you need f
82.
▲
by
lkitching
9y ago
Neither callbacks nor dependency injection are functional concepts, and implicit loops are pervasive in Ruby (and non-linear control flow in general). OO in Ruby is quite a long way from structs + function pointers.
83.
▲
by
lkitching
10y ago
This isn't the same thing - Idris encodes the state machine in the type system, C++ enforces it dynamically.
84.
▲
by
lkitching
10y ago
All bugs "shouldn't happen in the first place", the use of types is to reduce the surface area for where errors can be introduced. If you read some value from an external source and subsequently use measure types then you
85.
▲
by
lkitching
10y ago
So am I - storing multiple values in a cell violates first normal form.
86.
▲
by
lkitching
10y ago
I wouldn't say someone who's never heard of first normal form has 'good CS fundamentals'.
87.
▲
by
lkitching
10y ago
I understood from your comment that the imperative version "avoids building the name size list of persons" that you thought the declaritive version would construct an intermediate List[Person] the same size as the source list of n
88.
▲
by
lkitching
10y ago
Most languages implement map and filter in terms of lazy sequences so they would not allocate an intermediate list (Scala is an exception but I believe you can request laziness).
89.
▲
by
lkitching
10y ago
You don't need hash codes to be unique for items in the table so there doesn't need to be any relation between the size of the hash and the size of the table. The time taken by the hash function depends on the size of the keys not
90.
▲
by
lkitching
10y ago
By 'pass around', I mean pass around instances, not definitions. You could define your own Eq interface in F# type IEq<'a> = abstract member eq: 'a -> 'a -> bool but you then need to explicitl
More ›