- Apr 2022
-
cs3110.github.io cs3110.github.io
-
magic
Perhaps we should rename this "blackmagic". ;)
-
-
cs3110.github.io cs3110.github.io
-
Between each run, you will need to delete the bisectNNNN.coverage files, otherwise the report will contain information from those previous runs:
I'm surprised this operation is not done via some
dune
task. I'd expect the "plugin" for dune to add high-level commands to reset the test coverage; or to perform the reset automatically at each execution of a test. -
bisect_ppx
What does 'ppx' stands for?
-
-
cs3110.github.io cs3110.github.io
-
One study (Fagan, 1976)
It's a billion dollar industry and there are no studies more recent than 1976?
-
one study conducted at IBM (Jones, 1991)
It's a billion dollar industry and there are no studies more recent than 1991?
-
- Mar 2022
-
cs3110.github.io cs3110.github.io
-
In addition to specifying functions, programmers need to provide comments in the body of the functions. In fact, programmers usually do not write enough comments in their code.
Programmers need to provide comments where the information one would write in a comment can't be conveyed in the code.
-
We have several ways to deal with partial functions. A straightforward approach is to restrict the domain so that it is clear the function cannot be legitimately used on some inputs. The specification rules out bad inputs with a requires clause establishing when the function may be called. This clause is also called a precondition because it describes a condition that must hold before the function is called
A "requires clause" is a precondition declaring the sub-set of input values that are not restricted by the type on which the function is defined (e.g. x >= 0, if x : int)
-
How might we specify sqr, a square-root function? First, we need to describe its result. We will call this description the returns clause because it is a part of the specification that describes the result of a function call. It is also known as a postcondition: it describes a condition that holds after the function is called. Here is an example of a returns clause:
The "return clause" is a postcondition declaring what is the result of the function; including domain-specific properties of the result (e.g. accuracy of approximative operations).
-
because client programmers will not always take the effort to read a long spec
Because client programmers are pressed to read the full spec, we should not abuse and show respect for their time and attention.
-
-
cs3110.github.io cs3110.github.io
-
But it’s not so pleasant to figure out which of the three operators to use where.
Consistently naming methods that are returning an option, or raising an exception, would signal when to use one pipeline operator instead of the other.
-
-
cs3110.github.io cs3110.github.io
-
module Inner : X = struct
Is it necessary to specify :X here given it is already declared in the signature of T?
-
-
cs3110.github.io cs3110.github.io
-
the inefficiency is not from the pipeline operator itself, but from having to construct all those unnecessary intermediate lists.
Is there a way to generate list lazily and apply all the operations to each element as it is produced? I'm thinking about Haskell, Rust, Java Streams, etc. where the elements are generates on-demand and only the final result is inserted in the final list.
-
-
cs3110.github.io cs3110.github.io
-
assumes that the function identifier f has a particular type
How is the initial assumption choosen? Does it start with a completely generic type and then tries to narrow it down?
-
A method is a component of an object
I liked the definition of method used in Julia Language: a method is the implementation of a function for some concrete types of its parameters. For example the following are distinct methods for the function
sum(x,y)
:sum(x:int, y:int)
is distinct fromsum(x:float,y:float)
andsum(x:int,y:float)
andsum(x:float,y:int)
.I have a hunch that such definition can be restricted to match the OO static semantic by saying something like: a method in OO is the implementation of a function where only the type of the first argument is used for method-dispatching; when the method is defined inside the lexical scope of a class (data type) the first parameter is implicitly defined as
this: ClassType
...I hope this makes sense to some PL scientist, at least. If it does, I hope to see a definition of methods that can be specialised to match different language sematics.
-