Hi! I’m Charles. I’m mostly trying to get better at writing through blogging, but I hope there is some interesting stuff! charlesetc.com
I really enjoyed this article: the author has clearly put a lot of thought into it.
In my mind — and I consider myself one — I would use the term ‘modernist’ to describe this way of thinking. The idea that there is enlightenment to be achieved through endless refinement and attention — that coding is precisely an art, something worth this incredible degree of attention despite losing any semblance of productivity.
Now I really do think of coding as an art too, and I wholly encourage the author to enjoy this artistic aspect of coding they’ve found! But under no circumstances should this be considered the only artistic avenue when it comes to code. Sure, there’s an art to creating the most minimal, featureless, compact, piece of forth, but there’s also an art to creating the very best and most intuitive user interface, and an art to jumping into a hundred thousand line code base and getting your bearings, an art to creating languages that do try to span the divide between close-to-the-hardware and woderfully-abstracted, even an art to being the most ‘productive’, hammering out the most number of features in a short amount of time.
Absolutely enjoy your minimalism — maybe I’ll join you! — but there are many ways to have fun programming, and all should be acceptable.
I also did this and was very impressed! It was my only laptop for about a week and I could pretty much do everything except run a modern browser.
Roughly promising no runtime exceptions (a) doesn’t instill confidence and (b) exceptions are a feature not a bug. Surely a vastly overused feature, but a feature nonetheless. Pony is a language with an actual guarantee of no runtime exceptions and it makes some serious compromises to achieve that: types are sometimes more complex to track exceptions and division by zero is nonsensical. I’d need a more thought out argument from grain rather than just “it’s 2018”. That said, it looks like a cool project overall
There is apparently an ‘instruction’ with constructor ‘MError’. https://github.com/grain-lang/grain/pull/20/files#diff-927705db37dc34525f280901b665b1eeR109
Seems unlikely that it would have absolutely no runtime errors.
How mature is this implementation? The claims the Readme makes are pretty impressive but the documentation is hit or miss
You’d think a tech company could get that right. What really ticks me off is how the banking and financial industry seems to find subdomains so intolerable. It seems like every bank expects you to just implicitly trust any domain with their name in it.
Unfortunately “name” is ambiguous because when you say “filename” you definitely don’t mean just the stuff after the last slash.
There simply isn’t a place where, if you put types, it makes your code harder to change.
I wish this was true. However, types can make your program slightly harder to change — simply in that if you want to change the type of something, you’ve got to change the type annotation in addition.
With modern type inference, you probably only ever need to write out types explicitly on system boundaries, and the rest of the program can be inferred safely.
This is certainly true of some languages! OCaml, Haskell, and F# all have fully-inferred type systems (for the most part). However, there’s a lot of things that you can’t do within these inferred type systems, that you’d totally be able to do in a not-as-inferred system. Subtyping, for one, but also bindings to polymorphic references.
I totally agree with the overall inclination towards types and type inference, but it’s good to know where the limits are.
I literally was so happy to see this post because (a) I’m glad to see this information being more widespread and (b) it’s exactly what I learned in my recent PL class.
You might imagine my surprise that it turned out to be my recent PL class… Hi Mark! (It’s Charles)
Haha, hey Charles! CS221 for life :)
P.S. any interest in hacking on a monadic SNAPE? DM me if so!
http://propertesting.com/ is a nice one, targeted at Erlang.
This blog for the hypothesis Python library has a lot of great articles about how to use this stuff in “enterprise-y” software.
To be honest it was way more convincing to me than most other articles as to the utility of this stuff for higher-level applications
It seems when they say “functional” they mean “purely functional” or “haskell”.
The functional style of programming, in contrast, represents programs as relationships between mathematical expressions which are based on dependencies
the leading functional language (Haskell)
Is haskell the leading functional language? It seems like there are several ahead of it: scheme, ML, erlang, maybe prolog, maybe swift depending on your definition of functional.
Lastly, I’m not sure it’s fair to compare C++, a language without a GC, with Haskell which does have a GC. Certainly if you were really interested in comparing functional vs. imperative languages, I’d want to see a larger variety in the mix.
Referential transparency is a pretty central concept in FP. Every modern language can let you have basic pattern-matching and first-class functions. But that’s not functional programming in and of itself.
You certainly can program in a functional style in, say, Scala, but it ends up looking like really ugly Haskell code anyway. Other times you’re usually just using first-class functions as someone might drop in English terms when speaking their native non-English language.
It’s pretty common to think of Haskell as the functional language since it’s both pure and widely used. The fairness is questionable. Of the imperative languages, C++ is the goto choice for programming in the large that has to be efficient. It’s flexible enough to do a lot of different styles. The fact that Haskell has a GC is a language, design choice on their part. C++ offers several options. If the design slows it down, then that’s just what they chose. That Rust has some features of functional language without a GC might make it a nice alternative, though. Might even be able to do both imperative and functional version in it.
Computers only deal with numbers, and so to get a computer to analyse text data — for example, to find topics, to translate, to summarise, etc — you must first convert the data into numbers.
While it’s reasonable to convert words into vectors for analysis, it’s not because “computers only deal with numbers”
Very nice descriptions and clear examples. Row polymorphism is brought up a lot when discussing e.g. the deficiencies of Haskell’s built-in records, or algebraic effect systems, but these examples have more of an OO flavour than a functional one.
I’ve not actually used OCaml (although I have used StandardML), but I often hear that its users tend to avoid its OO-style features. Are those examples indicative of how real OCaml users would write code, or would they tend to use some other approach (e.g. modules)?
Yeah almost no one uses objects in OCaml nowadays. They use dynamic dispatch for method calls and so tend to be slower than non-object-oriented OCaml code.
Literally so happy to see recognition for structural types and row types!!! The coolest part of this which isn’t necessarily emphasized in the article is that these types are inferred in both OCaml and Crystal.
“Truly immutable timestamps could be useful”
As with most stuff, there’s already a standard for that. One company, Surety, even puts the hash of their timestamp ledger (hash chains) in the New York Times to create a paper trail. I’m sure the decentralized checking part could be scaled horizontally a bit without much change in protocol or energy usage. The individual operations are still simple enough to do on chips that are a few bucks each.
there’s already a standard for that. One company…
The big feature that Bitcoin and other blockchains bring to the table is decentralization. If you can rely on a company for stewardship of your ledger, then by all means use a permissioned database like Surety does.
On the trusted timestamping page you linked, if you skip to the decentralized section, you can see it immediately starts talking about Bitcoin.
I’m not sure how much Surety’s service costs, but piggybacking on the Bitcoin or Ethereum blockchains is likely far cheaper. Here is a tutorial on how to store a message as an Ethereum contract. The cost is variable with the string length, but in this case only cost about $0.20. It works by deploying a solidity contract that is just a couple string variables. The output is observable on etherscan.
In my model, several foundations in different countries run by different people would agree on a protocol. It would store stuff in SQLite, FoundationDB, or something similarly fast/resilient. A web or app server with plenty of cache would give snapshots of the ledgers. They’d charge a fixed price for bandwidth and storage which could go up as the tech improves.
This setup for something small like hashes with a niche audience could run on $5/mo VM’s. Even dedicated servers, 5-way redundancy with years of compute, storage, and bandwidth would be just over a $1,000 a month. The components theyd use are so vanilla the admins could be part-time. How much does Ethereum or Bitcoin cost in comparison?
Check it out, this message cost $0.80. Zero sysadmin effort on my part due to leveraging a preexisting system. Also, the message won’t vanish if I stop paying VPS bills.
If you’re a large corporation that wants to timestamp thousands or millions of messages, the centralized approach could very well be cheaper. For me, verifying maybe a handful of messages per year, it’s way easier to piggyback on a large blockchain project.
That’s a decent point. If you’re just externalizing and aimjng for low cost, you can post the messages in threads of diverse forums, Pastebin, etc. I used to do that with hashes on blogs. Never cost a cent.
verifying maybe a handful of messages per year
What’s your actual usecase for this? I struggle to see viable usecases for the blockchain beyond speculation so it’s interesting to hear what people consider are valid usecases for it.
I should have worded that differently… I don’t timestamp messages all that often. What I meant to convey is that $1000/mo is definitely overkill for anyone with intermittent needs.
Pastebin and forum posts are fine, but centralized. If Pastebin ever goes down, or starts manipulating old posts, then the integrity of your verification is compromised. Embedding the message in Ethereum’s blockchain is a much stronger guarantee of permanence and immutability.
What sorts of blog posts need such tamper-proofing? Anything dealing with warrant canaries, reverse engineering, or low-level firmware might deserve it.
I should have worded that differently… I don’t timestamp messages all that often. What I meant to convey is that $1000/mo is definitely overkill for anyone with intermittent need
The $1,000/mo is for the hardware and bandwidth to run the alternative to a blockchain. In the blockchain, you’re a user that pays for a tiny portion that you use. In the alternative, you’d similarly pay for a tiny portion that you use. Maybe a membership fee that covers general cost of operations with you paying the usage parts at cost. I gave the examples of $5 VM’s to illustrate the difference between whatever Bitcoin is doing for mining or transactions. I imagine it takes a bit more hardware than $5/mo.
The other article today said companies were paying $10,000 a unit for what supports this system. My hypothesis was getting orders of magnitude better performance with a year of usage at the same price with five-way checking. Adding actors that don’t trust each other just adds small amounts to the system without dragging down the speed of its main DB’s. Whereas, the folks buying the ASIC’s are spending tens of millions to support almost nothing in terms of transactions. The traditional tech is so cheap that I was using blogs to do my version of it. They didn’t even notice. That’s the difference between crypto-currency tech and traditional tech w/ decentralized checking.
Pastebin and forum posts are fine, but centralized. If Pastebin ever goes down, or starts manipulating old posts, then the integrity of your verification is compromised. Embedding the message in Ethereum’s blockchain is a much stronger guarantee of permanence and immutability.
It doesn’t solve the permanence problem, but just signing text is sufficient to address tampering, which doesn’t use a lot of electricity. So is being permanent the selling point? There is also ipfs which doesn’t require PoW but is decentralized, would that + signing be sufficient for your needs?
Basically, I’m still struggling to figure out what the blockchain does that makes the excessive energy usage worthwhile. Maybe I’m just being narrow minded, but I still only really see financial speculation as the primary motivator, so if that becomes unviable, why would anyone continue to run a bitcoin node (and there goes the permanence?)
Yeah, you’d really need to know the use case to try to use it as justification for the Bitcoin blockchain and all its baggage. As the full quote from the linked article says:
Truly immutable timestamps could be useful — assuming anyone finds a timestamp use case so important that it warrants a country-sized percentage of the world’s electricity consumption.
Ah, sure. Immutable timestamps are a fun way to piggyback on the existing Bitcoin and Ethereum blockchains, but timestamping by itself is not a justification for those coins existing.
plenty of hype here too: https://guardtime.com/ for example
Oh Lord… they gotten bitten by the bug. No surprise, though, since it’s a fad with momentum and lots of money. I expect any company that can do a blockchain product to build one just to make money off it. Given their prior work, there’s little reason to think they actually needed a blockchain vs hash chains with distributed checking and/or HSM’s. Just cashing in. ;)
Btw, do check out that Functional-Relational slide deck I submitted. It shows the Out of the Tar Pit solution is essentially what the new, GUI frameworks are doing. It was just years ahead. So, maybe some practical uses for some version of their model.
Guardtime’s KSI Blockchain is probably my favourite blockchain hype. The product was first released in 2007 and they only branded it “blockchain” a few years ago … for marketing reasons.
I have a post about it here. In one of their white papers, they literally redefine “blockchain” to mean containing a Merkle tree:
Unlike traditional approaches that depend on asymmetric key cryptography, KSI uses only hash-function cryptography, allowing verification to rely only on the security of hash-functions and the availability of the history of cryptologically linked root hashes (the blockchain).
I hear cryptocurrency people touting Estonia’s BLOCKCHAIN REVOLUTION as great news for Blockchain, and even great news for cryptocurrency. It’s not even a blockchain.
I mean, I have no reason to think there’s anything wrong with it. I’m sure it does its job just fine. But goodness me, it’s the greatest marketing success “blockchain” the buzzword ever saw.
If anything, it was a great way to show we didnt need a blockchain when our older concepts were working fine. They might benefit by using the buzzword. Yet, such misleading usage just reinforces the phenomenon where the BS spreads further.
Im not even sure it’s reversible at any level given these fads usually either level off or implode with the name and reputation damage permanently attached to whatever the name touched. AI Winter, expert systems, and Common LISP are some of best examples.
There’s probably a post I need to write on this topic: basically, we’re going to see a resurgence in the popularity of linked lists with hashes, and they’re going to be branded “blockchain(tm)”. There are a few non-bogus projects along these lines, but it’s not so great actually and in all cases they should have just used a frickin database.
Likely case, we get mostly-working systems that have an eternally painful “blockchain(tm)” implementation at the core that can’t easily be replaced by something sane.
Sure thing! Trusted timestamping is actually one of my goto examples for hash-chain-using tech that predates blockchain craze. What timestamping-on-blockchain folks hope to achieve is what such companies have been doing reliably and efficiently for years now. Better to just invest in and improve on efficient models that already work.
The standard isn’t the hard part, the trust is.
How much money would it take to bribe the Surety employee who has the fewest scruples? That’s about the ceiling for which you can bet on their authentication service.
The thing I push is centralized, standard ledgers with decentralized checking. For Surety done that way, it would take you bribing all the checkers. Alternatively, the HSM’s can mitigate some of the insider risk.
I would think most other domains like .com and .net would already have most short names registered.
I like .space, .blue, .coffee, .kiwi, .pink, .ink, among others. :) I guess I’m looking for all of them…
The closest I can think of https://dailychanges.domaintools.com/
Why ask for our work email to download it? It comes across as very creepy and also unfortunate for those of us who don’t have one…
well… it used to be a beta registration page. which we copied from another landing page that required your work email. it doesn’t make sense at all and I’ll remove it on the next deploy.
which platform are you on?
I’m still fine-tuning the build for Mac and the app store. You can try it out here (but it won’t automatically update) https://s3.amazonaws.com/winds-2.0-releases/releases/Winds-2.0.173.pkg
By this point, you might be thinking that the obvious solution is to just disable push notifications entirely.
After a few days, I realized that my brain had become so accustomed to my phone telling me what I needed to attend to, that I felt lost when I didn’t have those cues.
How long did you try this for? I’ve completely disabled push notifications on my computer for a few months, and I think over time I’ve ended up compulsively opening email/slack/etc. less. What was important was not just removing the notifications, but other visual cues (for example, having my dock always visible on macOS, which would display little red icons). On the other hand, I think I would have little success if I tried to do this on my phone, so I don’t. I view my phone as less of a working tool anyways, so I’m okay with this. Most importantly, when I’m trying to focus I can reasonably restrict my access to my phone, but less so with my computer.
I’ve personally struggled more with the idea that Something Very Important could have happened since I last checked in. The set of things that trigger this are much smaller, but they exist enough to be a problem at least every few days. For example, when I’m anticipating a results of an exam that I don’t think went particularly well, I tend to open email and check every time my mind drifts. I don’t think consuming content purely in digest form would fix this. Perhaps aggressive filtering would work, but I haven’t tried this and am generally suspicious of “productivity/mindfulness solutions” that require lots of active effort.
I only tried it for about five days. Perhaps a longer experiment is in order. I’ve also done a lot of visual decluttering on my computer, e.g. removing my bar, notifications, etc.
I can attest that both a minimal computing environment and disabling notifications have helped me transition out of a time when I was feeling similar to how you’ve described.
I think the pushback is valid but I still like the idea that by default values shouldn’t change. If you want real immutability, we’re stuck with the library options which actually work great, but I think there’s no harm in “overuse” of const, other than it seems to annoy the op, and others.
The author does claim that there is harm in the overuse of const. His argument is in Section 5 and basically says that when you use const for things that happen to be immutable, instead of things that are intended to be immutable, then you’re loosing the potential communication benefits from const.
I think the author would agree that default values shouldn’t change, but const doesn’t guarantee immutability, just not reassignment.
The authors argument here, though, is basically “We all know what const means but it doesn’t mean what I think it should do”. I don’t know of any JS engineers who use const and are confused that it doesn’t guarantee the immutability of every aspect of the variable. I do agree that emphasis on const is overrated.
I actually have more time for the unmade argument that there’s too much focus on “this should be const” rather than “does this need to be let, can we find a way to not do that?”
Never heard of it, but it seems like a super interesting approach to interactive environment. I cannot help but remember this Bret Victor’s talk about how we have been programming in almost-anachronistic ways with no innovation in the interfaces.
There’s nothing obsolete about text. Visual languages don’t work. They’ve been tried hundreds of times, to no avail, because GUIs are fundamentally bad user interfaces for experienced users. Text is a better interface for power users, and programming languages are for power users.
Why can’t I re-sort the definitions in my source instead of scrolling around then? Why is it hard to see a dependency graph for all my functions? Why do I have to jump between files all the time? Text - an interface for linear presentation of information - is fundamentally a kludge for code, which is anything but linear.
Sort them by what? It wouldn’t be difficult to write a script using the
compilermodule of Python to reorder the declarations in your file in an order you chose, which you could then use to replace the text of a buffer in your text editor. But usually I’d suggest what you want is to see a list of definitions in a particular order, which you could then use to jump to the definitions.In every case that I’ve seen of not using plain text, it inevitably become inscrutable. What is actually in my Smalltalk/Lisp image? What is actually there? What can people get out of it later when I deploy it?
Because nobody has written something that will take your source files, determine their dependencies, and produce the DOT output (a very popular text-based format for graphs, far superior in my opinion to any binary graph description format) for that graph? It’s not like it’s particularly difficult.
Because it turns out it’s useful to organise things into parts. Because it turns out it’s useful to be able to parallelise compilation and not reparse every bit of code you’ve ever written every time you change any part of it.
I think that it’s definitely a requirement of any decent programming language to have a way to easily take the source code of that programming language and reify it into a syntax tree, for example. That’s very useful to have in a standard library. In Lisp it’s just
read, Python has more complex syntax and requires more machinery which is in a standard library module, other languages have similar things.One point might be: maybe you don’t need a dependency graph if you can just make your code simpler, maybe you don’t need to jump around files much if your code is properly modularised (and you have a big enough screen and narrow enough maximum line length to have multiple files open at once), maybe sorting your definitions is wrong and what you want is a sortable list of declarations you can jump to the definitions.
Not to mention that version control is important and version controlling things that aren’t text is a problem with conventional version control tools. Might not be an issue, you have your own VCS, but then you enter the land of expecting new users of your language to not only not use their standard editor, but also to not use their standard VCS, not use their standard pastebin, etc. How do you pastebin a snippet of a visual language so someone on an IRC channel can see it and give you help? How do you ask questions on StackOverflow about a visual language?
It’s not even an issue of them being unusual and unsupported. By their very nature, not using text means that these languages aren’t compatible with generic tools for working with text. And never will be. That’s the thing about text, rather than having many many many binary formats and few tools, you have one binary format and many many tools.
Hey Miles, thanks for elaborating. I think we could have more interesting discussions if you give me a bit more credit and skip the trivial objections. You’re doing the same thing you did last time with C++ compilers. Yes, I know I could write a script, it’s not the point. I’m talking about interactive tools for source code analysis and manipulation, not a one-off sort.
I don’t agree with your objections about parallel compilation and parsing. It seems to me that you’re just thinking about existing tools and arguing from the status quo.
Further down, you make a suggestion which I interpret as “better languages could mitigate these issues” which is fair, but again I have to disagree because better languages always lead to more complex software which again requires better tools, so that’s a temporary solution at best.
You also raise a few objections, and here I should clarify that what I have in mind is not some kind of visual flowchart editor. What I’m claiming is that the conflation of internal representation and visual representation for code is counterproductive, but I think that a display representation that mostly looks like text is fine (as long as it’s actually within a structured editor). What I’m interested in is being able to manipulate symbols and units of code as well as aspects of its structure rather than individual characters.
Consequently, for pastebin or StackOverflow, you could just paste some text projection of the code, no problem. When it comes to VCS, well, the current situation is quite poor, so I’d welcome better tools there. For example, if there was a VCS that showed me diffs that take into account the semantics of the language (eg like this: https://www.semanticmerge.com), that would be pretty cool.
For the rest of your objections, I offer this analogy: imagine that we only had ASCII pictures, and none of this incompatible JPG/PSD/PNG nonsense with few complicated tools. Then we could use generic tools for working with text to manipulate these files, and we wouldn’t be constrained in any way whether we wanted to create beautiful paintings or complex diagrams. That’s the thing about text!
I think the practitioners and particularly academics in our field should have more sense of possibilities and less affection for things the way they are.
Existing VCS could work reasonably well if the serialisation/“text projection” was deterministic and ‘stable’, i.e. minimising the amount of spurious changes like re-ordering of definitions, etc. As a first approximation I can imagine an s-expression language arranging the top-level expressions into lexicographic order, spreading them out so each sub-expression gets its own line, normalising all unquoted whitespace, etc. This would be like a very opinionated
gofmt.If users wan’t to preserve some layout/etc. then the editor can store that as metadata in the file. I agree that semantics-aware diffing would be great though ;)
So you always end up separating the storage format from display representation in order to create better tools, which is exactly my point.
Yes, I agree with your points. Was just remarking that some of these improvements (e.g. VCS) are easier to prototype and experiment with than others (e.g. semantics-aware queries of custom file formats).
The way I see it is that there are tools for turning text into an AST and you can use them to build the fancy things you want. My point wasn’t ‘you can write that sort as a one-off’. You can edit code written in a text-based programming language with a really fancy editor that immediately parses it to an AST and works with it as an AST, and only turns it into text when written to disk. I have no problem with that. But really you’re still editing text when using something like
paredit.Something like vim but where the text objects are ‘identifier’, ‘ast node’, ‘expression’, ‘statement’, ‘logical line of code’, ‘block’, etc. rather than ‘text between word separators’, ‘text between spaces’, ‘line’, etc. would be a useful thing. In fact, you could probably do this in vim. I have an extension I use that lets you modify quotes around things taking into account escaped quotes within, etc. That’d probably work way better if it had that default structure for normal text and then could be customised to actually take into account the proper grammar of particular programming languages for which that is supported.
What I’m concerned about is the idea that it’s a good idea to store code in a proprietary binary file format that’s different for every language, where you can’t use the same tools with multiple languages. And then having to reimplement the same basic functionality for every single language in separate IDEs for each, where everything works slightly differently.
I do find it useful that I can do
ci(and vim will delete everything inside the nearest set of parentheses, properly taking into account nesting. So if I have(foo (hello 1 2 3) bar)and my cursor is on thea, it’ll delete everything, even though the nearest ( and ) are beside hello and not foo. That kind of thing, more structured editing? I’m all for that.Ultimately I think if you have a recognised standardised text projection of your code, you might as well just make that the standardised format for it, then your fancy editor or editor plugin can parse it into the structures it needs. This helps ensure you can edit code over SSH, and have a variety of editors compatible with it, rather than just the single language-designer-provided IDE.
One of the nice things about
gitis that it stores snapshots internally rather than diffs. So if you have a language-specific tool that can produce diffs that are better due to being informed by the grammar of the language (avoiding the problem of adding a function and the diff being ‘added a new closing brace to the previous function then writing a new function except for a closing brace’, for example), then you can do that! Change thediffalgorithm.Well I mean I do much prefer creating a graph by writing some code to emit DOT than by writing code to emit PNG. I did so just the other day in fact. http://rout.nz/nfa.svg. Thank god for graphviz, eh?
Note that there’s also for example farbfeld, and svg, for that matter: text-based formats for images. Just because it’s text underneath doesn’t mean it has to be rendered as ASCII art.
Cool, I’m glad we can agree that better tools would be good to have.
As far as the storage format, I don’t actually have a clear preference. What’s clearly needed is a separation of storage format and visual representation. If we had that, arguments about tabs vs spaces, indent size, let/in vs where, line length, private methods first or public methods first, vertical vs horizontal space (and on and on) could be nullified because everybody could arrange things however they like. Why can’t we have even such simple conveniences? And that’s just the low hanging fruit, there are far more interesting operations and ways of looking at source that could be implemented.
The other day there was a link to someone’s experiment (https://github.com/forest-lang/forest-compiler) where they use one of the text projections as the storage format. That might work, but it seems to me that the way parsing currently happens, there’s a lot of unnecessary work as whole files are constantly being reparsed because there is no structure to determine the relevant scope. It seems that controlling operations on the AST and knowing which branches are affected could be a lot more efficient. I’m sure there’s plenty of literature of this - I’ll have to look for it (and maybe I’m wrong about this).
I understand your concern, but this sounds exactly like the current state of affairs (other than really basic stuff like syntax highlighting maybe). There’s a separate language plugin (or plugins) for every combination of editor/IDE and language, and people keep rewriting all that stuff every time a new editor becomes popular, don’t they?
Sure, we can glean a bit more information from a pair of snapshots, but still not much. It’s still impossible to track a combination of “rename + change definition”, or to treat changes in the order of definitions as a no-op, for example. Whereas if we were tracking changes in a more structured way (node renamed, sub-nodes modified etc.), it seems like we could say a lot more meaningful things about the evolution of the tree.
Perhaps the analogy was unclear. Being able to write a set of instructions to generate an image with a piece of software has nothing to do with having identical storage format and visual representation. If we approached images the same way we approach code, we would only have ASCII images as the output format, because that’s what is directly editable with text tools. Since you see the merits of PNG and SVG, you’re agreeing that there’s merit in separating internal/storage representation from the output representation.
I might have missed something, but I didn’t see anyone proposing this.
In particular, my understanding of Luna is that the graphical and textual representations are actually isomorphic (i.e. one can be derived if given the other). This means we can think of the textual representation as the being both a traditional text-based programming language and as a “file format” for serialising the graphical programming language.
Likewise we can switch to a text view, use grep/sed/etc. as much as we like, then switch back to a graphical view if we want (assuming that the resulting text is syntactically valid).
Tools that improve navigation within textual source have existed for a long time. I’ve been using
cscopeto bounce around in C and Javascript source bases for as long as I can remember. The more static structure a language has, the easier it is to build these tools without ambiguity. The text source part isn’t really an issue – indeed it enables ad hoc tooling experiments to be built with existing text management tools; e.g.,grep.Those tools aren’t text, though. They’re other things the augment the experience over just using text which becomes an incidental form of storage. Tools might also use AST’s, objects, data flows, constraints, and so on. They might use anything from direct representation to templates to synthesis.
I think the parent’s point was just text by itself is far more limited than that. Each thing I mentioned is available in some programming environment with an advantage over text-driven development.
I think it’s wrong to say that the text storage is incidental. Line-oriented text files are about the lowest common denominator way we have to store data like this.
For starters, it’s effectively human-readable – you can lift the hood up and look at what’s underneath, understanding the effect that each individual character has on the result. Any more complicated structure, as would be generally required to have a more machine-first structured approach to program storage, is not going to have that property; at least not to the same extent.
If this thread demonstrates anything, it’s that we all have (at times, starkly!) different preferences for software engineering tools. Falling back on a textual representation allows us to avoid the need to seek consensus on a standard set of tools – I can use the editor and code manipulation tools that make sense to me, and you can stick to what makes sense to you. I think a lot of the UNIX philosophy posturing ends up being revisionist bunk, but the idea that text is a pretty universal interface for data interchange isn’t completely without merit.
The under-the-hood representation is binary-structured electricity that gets turned into human-readable text by parsing and display code. If already parsing it and writing display code, then one might just as well use a different encoding or structure. Text certainly has advantages as one encoding of many to have available. Plugins or input modules can take care of any conversions.
Text does often have tooling advantages in systems like UNIX built with it in mind, though.
I think it’s a reductionist argument for the good-enough, hard earned status quo. I think it can be valid, but only within a very narrow perspective - operational and short term.
To my mind, your position is equivalent to this: we should only have ASCII images, and we don’t need any of that PNG/JPG/PSD stuff with complicated specialised tools. Instead, we can use generic text tools to make CAD drawings, diagrams, paintings - whatever. All of those things can be perfectly represented in ASCII, and the text tools will not limit us in any way!
I want to search my code like a database, e.g. “show my where this identifier is used as a parameter to a function” - the tooling for text doesn’t support this. Structured tooling would be super useful.
Many things can be “queried” with grep and regular expressions. Which is also great to find “similar occurrences” that need to be checked but are only related by some operators and function calls following another. But on the other hand I’d definitely argue that IDEs at least have a tiny representation of the current source file for navigation or something and that you can click some token and find its uses, definitions, implementations … But it only works if I disable the low power mode. And with my 8Gb RAM MacBook I sometimes have to kill the IDE before running the program to make sure I can still use it at the same time.
Maybe if it wasn’t parsing and re-parsing massive amounts of text all the time, it would be more energy efficient…
Exactly. And it could extend beyond search; code could be manipulated and organised in more powerful ways. We still have rudimentary support for refactoring in most IDEs, and so we keep going through files and manually making structurally similar changes one by one, for no reason other than the inadequate underlying representation used for code.
I could be wrong and maybe this is impossible to implement in any kind of general way beyond the few specific examples I’ve thought of, but I find it strange that most people dismiss the very possibility of anything better despite the fact that it’s obviously difficult and inconvenient to work with textual source code.
The version of
cscopethat I use does things of that nature. The list of queries it supports:I use Find functions calling this function a lot, as well as Find assignments to this symbol. You could conceivably add more query types, and I’m certain there are other tools that are less to my admittedly terminal-heavy aesthetic preference that offer more flexible code search and analysis.
The base structure of the software being textual doesn’t get in the way of this at all.
Software isn’t textual. We read the text into structures. Our tools should make these structures easier to work with. We need data structures other than text as the common format.
Can I take cscope’s output and filter down to “arguments where the identifiers are of even length”?
Compilers and interpreters use structured representations because those representations are more practical for the purposes of compiling and interpreting. It’s not a given that structured data is the most practical form for authoring. It might be. But what the compiler/interpreter does is not evidence of that.
Those representations are more practical for searching and manipulating. Try it!
I would also be interested on your thoughts about Lisp where the code is already structured data. This is an interesting property of Lisp but it does not seem to make it clearly easier to use.
Sure it does: makes macros easier to write than a language not designed like that. Once macros are easy, you can extend the language to more easily express yourself. This is seen in the DSL’s of Common LISP, Rebol, and Racket. I also always mention sklogic’s tool since he DSL’s about everything with a LISP underneath for when they don’t work.
Sure, but all of these tools (including IDEs) are complicated to implement, error-prone, and extremely underpowered.
cscopeis just a glorifiedgrepunless I’m missing something (I haven’t used it, just looked it up). The fact that you bring it up as a good example attests to the fact that we’re still stuck somewhere near mid-twentieth century in terms of programming UI.I bring it up as a good example because I use it all the time to great effect while working on large scale software projects. It is relatively simple to understand what it does, it’s been relatively reliable in my experience, and it helps a lot in understanding the code I work on. I’ve also tried exuberant ctags on occasion, and it’s been pretty neat as well.
I don’t feel stuck at all. In fact, I feel wary of people attempting to invalidate positive real world experiences with assertions that merely because something has been around for a long time that it’s not still a useful way to work.
Have you noted, that the Luna language has dual representation? Where each visual program has an immediate and easily editable text representation, and the same is true in the other direction as well? This is intended to be able to keep the benefits of the text interface, while adding the benefits of a visual representation! That’s actually the main idea behind Luna.
What about the power users who use things like Excel or Salesforce? These are GUIs perfectly tailored to specific tasks. A DJ working with a sound board certainly wouldn’t want a textual interface.
Textual interfaces are bad, but they are generic and easy to write. It’s a lot harder to make an intuitive GUI, let alone one that works on something as complex as a programming language. Idk if Luna is worthwhile, but text isn’t the best user interface possible imho
DJs use physical interfaces, and the GUIs emulation of those physical interfaces are basically all terrible.
I’ve never heard of anyone liking Salesforce, I think that must be Stockholm Syndrome. Excel’s primary problem in my opinion is that it has essentially no way of seeing how data is flowing around. If something had the kind of ‘reactive’ nature of Excel while being text-based I’d much prefer that.
Textual interfaces are excellent. While there are tasks that benefit from a GUI - image editing for example - in most cases GUIs are a nicer way of representing things to a new user but are bad for power users. I wouldn’t expect first year computer science students to use vim, as it’s not beginner-friendly, but it’s by far the best text editor out there in the hands of an experienced user.
I’d call myself an “experienced user” of vim. I’ve written extensions, given workshops, and even written a language autoindent plugin, which anyone who’s done it knows is like shoving nails through your eyeballs. About once a year I get fed up with the limitations of text-only programming and try to find a good visual IDE, only to switch back when I can’t find any. Just because vim is the best we currently have doesn’t mean it’s actually any good. We deserve better.
(For the record, vim isn’t beginner-unfriendly because it’s text only. It’s beginner-unfriendly because it’s UI is terrible and inconsistent and the features are all undiscoverable.)
Most people don’t bother to learn vimscript properly, treating it much like people treated Javascript for years: a bunch of disparate bits they’ve picked up over time, with no unifying core. But once you actually learn it, it becomes much easier to use and more consistent. The difference between expressions and commands becomes sensible instead of seeming like an inconsistency.
I never get fed up with the limitations of text-only programming, because I don’t think they exist. Could you elaborate on what you are saying those limitations are?
And I totally, 100% disagree with any claim that vim’s UI is bad or inconsistent. On the contrary, it’s extremely consistent. It’s not a bunch of little individual inconsistent commands, it’s motions and text objects and such. It has extensive and well-written help. Compared to any other IDE I’ve used (a lot), it’s way more consistent. Every time I use a Mac program I’m surprised at how ad-hoc the random combinations of letters for shortcuts are. And everything requires modifier keys, which are written with ridiculous indecipherable symbols instead of ‘Ctrl’ ‘Shift’ ‘Alt’ etc. Given that Mac is generally considered to be very easy to use, I don’t think typical general consensus on ease of use is very instructive.
Bret Victor explains the persistence of textual languages as resistance to change, drawing an equivalence between users of textual languages now and assembly programmers who scoffed at the first higher-level programming languages. But this thread is evidence that at least some people are interested in using a language that isn’t text-based. Not everyone is fairly characterized by Bret Victor’s generalization. So then why hasn’t that alternative emerged? There are plenty of niche languages that address a minority preference with reasonable rates of adoption. With the exception of Hypercard, I can’t think of viable graphical programming language. Even Realtalk, the language that runs Dynamicland (Bret Victor’s current focus), is text-based, being a superset of Lua. I keep hearing about how text-based languages are old-fashioned and should die out, but I never hear anything insightful about why this hasn’t happened naturally. I’m not denying that there are opportunities for big innovation but “make a visual programming language” seems like an increasingly naive or simplistic approach.
I think it has to do with the malleability of text. There’s a basic set of symbols and one way to arrange them (sequentially.) Almost any problem can be encoded that way. Emacs’ excellent org-mode is a testament to the virtue of malleability.
Excel also has that characteristic. Many, many kind of problems can be encoded in rectangles of text with formulas. (Though I might note that having more ways to arrange things allows new kinds of errors, as evidenced by the growing cluster of Excel features for tracing dependencies & finding errors.)
Graphical languages are way less malleable. The language creator decides what elements, relations, and constraints are allowed. None of them let me redefine what a rectangle represents, or what relations are allowed between them. I think that’s why these languages can be great at solving one class of problem, but a different class of problem seems to require a totally different graphical language.
My suspicion is that it’s because graphical languages merge functionality and aesthetics, meaning you have to think very, VERY hard about UI/UX and graphic design. You need to be doing that from the start to have a hope of it working out.