guitarvydas
04/18/2023, 9:43 AMKartik Agaram
echo
hard-wired into your example. Again, this is fine. I wouldn't get too hung up on this. The technical idea is sound. You just need a better name and positioning to avoid these distracting quibbles and focus the audience's attention on the core idea.
• Request for example #1: How might you perform dependency injection with components? Pass something into a port that causes a component with that name to be invoked? Does this help make things more decoupled? Dependency injection does help decouple functions.
• Request for example #2: Check out the example of run-length encoding at https://www.chiark.greenend.org.uk/~sgtatham/coroutines.html. I'm curious how this program would look with your approach. Might you need coroutines? A component can have multiple inputs and outputs in parallel. Can it have multiple outputs in series? So that pumping in one input results in multiple outputs? Then this question has me wondering if it should have multiple inputs in series as well. What might that mean?
• You've mentioned before that this looks like hardware. One challenge with designing hardware circuits is getting just right the timing of signals coming into a piece of combinatorial circuit, and debugging the weird errors when we don't. We need the sequential latches just so to make the circuit more robust. But the latches add latency. I wonder if your approach shares this problem. What are the semantics of a component with two inputs that receives a signal/value on only one of them? You could block and wait for the other, or not. Both seem to have trade-offs, and I think I can construct subtle bugs both ways.
• There are still some gaps before this can be the notation for concurrency. As you said, you need both functions and components to coexist. And you need a way to go between them: wrap a series of function calls in some queues to turn it into a component, or wrap a set of components into a function so you can give it a name/address to combine with multiple sets of queues. Functions provide abstraction. Copying components does not.
On the whole, this needs a whole lot more examples. I'd forget the tooling initially and just hand-write a bunch of examples. Do they seem clear? Are there notational changes that might make them clearer? Etc.guitarvydas
04/24/2023, 11:42 AMKartik Agaram
In 2023, though, compilers are “easy” to build.Sure, but these are compilers for the sorts of languages you criticize. They use functions, are overly synchronous. I haven't seen any evidence they are able to deduplicate huge swathes of code in large parts of a program. The best they can do is fold together a few expressions within the same function.
guitarvydas
06/14/2023, 10:11 AMint plus97 (int x) {
return x + 99 - 2;
}
int pt1 (int x) {
return plus97 (plus97 (x));
}
$ gcc -O3 -S pt1.c
turns this into:
int pt1 (int x) {
return x + 194;
}
Then, there’s git, diff, NiCaD Clone Detector (Cordy, Roy).
[aside: the above quoted essay doesn’t actually contain a statement about “deduplication”, but, it does sound like something I would say. I wonder what I was thinking when I wrote that? I wonder what it made you think?]Kartik Agaram
guitarvydas
06/14/2023, 11:34 PMKartik Agaram
guitarvydas
06/15/2023, 9:53 AMKartik Agaram
..if you can do inlining, then deduplication is just around the corner.
If you can do multiplication, factoring is around the corner? 🙂 You don't need thread safety to access more than one CPU. You only need it for threads that share data. Keep the data disjoint, and life is much better.
Is it safe to say that you saw this essay around Apr. 18 (the date of the original post in this thread)?
Definitely. Could be an incorrect link on my part as well, or I might not be quoting you exactly.. You're absolutely right that compilers may not be needed for many tasks. Maybe just don't mention them. It would be very interesting to come up with a framework of some sort that lets people tag duplicate sections in their own code. Like a structured editor that allows transclusion.
guitarvydas
06/15/2023, 2:54 PMKartik Agaram
guitarvydas
06/19/2023, 12:47 AMCALL is used for 2 reasons: ..., (2) DRY ... [corollary: case (2) should be entirely optimized away at “compile time” and “edit time”]I still believe that the IDE/Editor should be able to help with deduplication. In the above, I say “entirely”, but, I don’t really care. 80% help would be better than what we are forced to live with now. ...I’ll try to expand on what I mean...
Kartik Agaram
guitarvydas
07/24/2023, 2:55 PM