I've documented the minimum rust version required today, although I'm looking at lowering the minimum version.
161 karma · joined May 15, 2009
http://www.wilfred.me.uk
I've documented the minimum rust version required today, although I'm looking at lowering the minimum version.
I did look at modelling moves in an earlier prototype, but it's incredibly hard to display the result in a coherent way when there are also insertions. It was also easier to drop it when I moved to Dijkstra.
As you can see in the screenshot in the readme, it does support inserting tree nodes whilst preserving children, which covers a ton of cases.
Compiler parsers aren't a great fit for difftastic. They discard comments, they may not give you output if there are syntax errors, and they're usually tied to a specific language version.
Since this format works well for Comby (Rijnard's talk is excellent: https://www.youtube.com/watch?v=JMZLBB_BFNg ) I'm hopeful it's an adequate solution for Difftastic.
It will also users to add their own custom syntax/config formats.
That said, using tree-sitter might be an option. It's more forgiving than compiler parsers.
Difftastic does not create a patch or worry about merging. That's a hard problem that I'm not trying to solve. Instead, it builds two ASTs, then marks each node as unchanged or novel.
To compute the diff, I use a graph search. Each vertex represents a position in both the left and right ASTs.
Suppose you're comparing A with X A.
Start node:
Left: A Right: X A
^ ^
The possible next nodes are:(1) Treat A on the left as novel.
Left: A Right: X A
^ ^
(2) Treat X on the right as novel. Left: A Right: X A
^ ^
Both (1) and (2) are the same 'distance', but (2) is closer to the end node, because there's a edge from (2) to the end that marks A as unchanged.I've implemented this using Dijkstra's algorithm. My graph is directed and acyclic, so there are faster algorithms like topological sort. However, I don't construct the whole graph in advance (that would take O(N^2) memory) so instead I construct the graph nodes as necessary.
(This is very similar to Autochrome, which I've linked in the README. Autochrome has a worked example which is really helpful.)
At some point I think I'll have to use A* search instead. If there are more than 500 lines of code with lots of changes, difftastic can take a few seconds to terminate due to the naive graph search.
I will tidy it up at some point, but I spend too much time throwing away ideas that don't work. Defensive code is silly if you delete it after!
I still look at diffs in the terminal pretty often, but all my code reviews are in rendered HTML.
That said, there needs to be a credible tool before review tools can adopt it! GitHub does a line-based diff with word-based highlighting, which is probably the best you can do without syntactic smarts.
I'm hoping that defining syntax in a separate TOML file will let end users extend difftastic for their own languages/config files. I want to keep difftastic small and manageable.
Syntactic differs already do better because they understand that parentheses/brackets are paired. Difftastic does OK with this example: https://imgur.com/a/pVlVBo5
Given the code:
foo(one, two, three);
If you add an argument and reformat: foo(
one,
two,
new,
three
);
A line-based diff can make it hard to spot what's changed.Managing $19.7 billion of other people's money presents interesting technology challenges. At Numeric, we're looking for Python people to help build, test and deploy the whole trading pipeline.
If you have experience in building systematic trading systems, or if you're interested in learning, we'd love to hear from you. We do friendly code review for knowledge sharing, and we also support staff in getting qualifications.
We have all the benefits of being an established, successful hedge fund but the developer team is still small enough to do a single standup in the morning. We have the best of both worlds.
Interested? Drop me an email at wilfred.hughes@man.com, and mention HN.
Managing $19.7 billion of other people's money presents interesting technology challenges. At Numeric, we're looking for Python people to help build, test and deploy the whole trading pipeline.
If you have experience in building systematic trading systems, or if you're interested in learning, we'd love to hear from you. We do friendly code review for knowledge sharing, and we also support staff in getting qualifications.
We have all the benefits of being an established, successful hedge fund but the developer team is still small enough to do a single standup in the morning. We have the best of both worlds.
Interested? Drop me an email at wilfred.hughes@man.com, and mention HN.
I don't think this is still the case. I sent an email to their sales email address, and heard nothing. I also tried contacting their engineer, and even found the MIT email address of the current copyright holder nothing.
I also reached out to Peter Paine, but he only sells Symbolics hardware.
Is it still possible to legitimately obtain the software?
Thanks for the kind words :)
1. The search term is highlighted.
2. The search is far more discoverable, its key binding means you can stumble across it.
3. The up cursor key is a better key binding choice. Pressing up without a search term may be considered as searching for commands that match "", namely everything. This conforms with fish's aim for orthogonality.
4. (Most importantly) The up cursor key has a natural undo button, down. Quick quiz: if you type "Ctrl-r foobarbaz", how do you get back to a terminal you can type in, preserving your search term? You can't. Pressing "Esc" dumps you in the middle of your history with something matching the first few characters of your search term. (Assuming you have nothing in your history matching 'foobarbaz')
Similarly, if you press "Ctrl-r foo Ctrl-r", you will get the second item in your history that matches foo. There's no way to get back to your first search result without repeating the search.
5. You can use previous commands as search terms. For example, I ran "mvn clean install", then hit "Ctrl-C" when I wanted to skip tests. I pressed "<Up> <Space> <Up>" and I was searching through all my history that contains "mvn install ". Using "Ctrl-C" I'd have had to retype "mvn clean install ".
a. Superb readline colouring. Nonexistent commands are shown in red, commands that exist and are on PATH in green. Unclosed string literals become obvious.
b. A history search that is orders of magnitude better that Ctrl-r in Bash. (Though oh-my-zsh has the history-substring-search plugin which provides this functionality.)
c. Features work out of the box, fish helps you avoid managing a .zshrc equivalent file.
d. Tab completion offers hints. If I type l<tab><tab>, I get:
leaftoppm (Convert Interleaf image format to a portable anymap)
less (Opposite of more)
lessecho (Expand metacharacters)
lessfile ("input preprocessor" for less.)
lesskey (Specify key bindings for less)
lesspipe ("input preprocessor" for less.)
lexgrog (Parse header information in man pages)
(These summaries are the first lines of the man pages.)2: I've only seen it crash on me once, which matches my experience with zsh. YMMV.
I used fish exclusively for a number of years, but eventually moved back to something sh-compatible. Too many wrapper scripts assume this.
FWIW: This is Chersterton's fence fallacy. This states that you should not criticise a viewpoint without understanding the reasoning behind it. The reasoning may be unsound, but without knowing it at all, criticism is useless.
Etymology is a complex and often convoluted topic, particularly for a language learner who may not be able to understand etymological information in the target language. Do you think there's no value at all in simplified memory aids, such as James Heisig's approach?
As for Kindle, the book design was sufficiently plain that I would have no concerns.
Still, the original point (node is cooperatively multitasked) was clear. Anything beyond that and I just want to reach for better Fibonacci algorithms.
S-K combinators[1] are a Turing-complete subset of lambda calculus. Here's an implementation of them:
k = (x) ->
(y) -> x
s = (x) ->
(y) ->
(z) -> x(z)(y(z))
1: http://en.wikipedia.org/wiki/SKI_combinator_calculuspwdhash still leaks the length of the password since it aims to give users visual feedback of characters being typed.
Then you've also got the issue of automatic update of plugins being compromised. The question is really: is it more secure than the alternatives?
In fact (for a sufficiently rigorous definition of virus), it is provably the case that we cannot determine whether a file is a virus, using an argument very similar to a halting problem proof.
You might be interested in 'Computer viruses: theory and experiments' by Fred Cohen for the full working-out of the proof.
I intend to write a Twitter client this year, since existing clients don't meet my needs:
* web app * multi-account support * rate-limit noisy accounts * automatic language detection for people who tweet in multiple languages
Sure, I'd love to find something that does this already. But I don't think it exists.