Toward a URL for every function
text.sourcegraph.com
text.sourcegraph.com
The README has some good links to try Sourcegraph at https://github.com/sourcegraph/sourcegraph/blob/master/READM...:
https://sourcegraph.com/github.com/square/okhttp/-/def/JavaA... (semantic code browsing for Java)
https://sourcegraph.com/github.com/golang/go/-/info/GoPackag... (http.NewRequest used in 8801 repositories)
Sourcegraph supports Go and Java right now. If you want to get access to the upcoming beta of JavaScript, Python, or other languages, send us a note at support@sourcegraph.com or https://twitter.com/srcgraph.
You can always get the URL on GitHub for a particular line number at a particular revision which won't break when the file changes. A persistent link to a function can break in a different way in that maybe the function, while named the same, changes behaviour in a way that it no longer does exactly what it originally did. It's not obvious to me which of these breakages is more relevant.
When you talk about "hackable" URLs it would be great to be able to get a URL for a named function at a particular revision. This solves both problems. I have an immutable reference to a particular piece of code, but then by hacking the URL I should be able to still see the most recent version.
I get what you're saying, but it seems like the URL mixes where you're coming from with where you want to take us.
(Hi Quinn! We met last year after the discussion around https://news.ycombinator.com/item?id=8308881)
We want to be able to track function moves and renames across packages or even repositories. It'll take some more work to get there.
The more general idea is a content-addressable function repository, where, as you point out, code would have to be in some kind of normal form. Joe Armstrong toys with this idea in his talk "The mess we're in," one of my favorites. [0]
The one really good idea in the whole Semantic Web train-wreck (and at this distance, I think it's fair to call it that) was that everything should have a negotiable, dereferencable URL. REST includes that core principle.
A lot of single-page web apps make me sad because they've been designed without reference to that. If what you're building is genuinely an application, then I get it; but most of the time what you're building is a catalogue, and everything in that can have an address, so it should.
Naming is hard... I think that's what makes the "semantic web" a kind of chimera even for those who endorse it. Can a URL really capture the worldwide identity of a thing? Over all time? And who's going to maintain all those names?
Suppose that naming everything is intractable as a human effort, but we still want addressability. Alan Kay takes this to the extreme, saying, why not give every object on the internet an IP address? [0] Not every resource, every object, in every program. It sounds facetious, but it's consistent with his general objects-as-computers-all-the-way-down view. His system designs (including those from VPRI) express the belief that hard barriers between the layers of a system (usage and application, application and framework, framework and OS) account for much of today's uncontrollable code bloat and the limits on how much scale systems can tolerate. The "everything gets an IP address" idea is just a recognition that network boundaries will eventually be seen the same way. From this perspective, it might be fruitful to think about how we'd identify things on the internet if they were homogenous with the objects in our applications.
[0] It's in one of his talks but I don't remember which.
Then the SOAP shitshow came to town, and now REST which is the rockstar, but people want better defined endpoints (RAML), um IDL was there in CORBA.
REST is definitely easier to use than CORBA was, but it's much more limited, and it always feels like we're just reinventing the wheel. And yes, REST is better for web APIs, but it's always felt lacking after using CORBA.
codeq allows you to track change at the program unit level (e.g. function and method definitions) and query your programs and libraries declaratively, with the same cognitive units and names you use while programming
Speaking of tracking changes at the method level, does anyone remember VisualAge for Java?
[1]: http://www.scala-sbt.org/0.13/sxr/CrossVersionUtil.scala.htm...
As for central hosting of packages I think it will work. But we will probably need to be able to have many src attributes in script-tags for redundancy and optimal caching.
code://github.com/edicl/hunchentoot/master/log.lisp?macro=with-log-stream
That would handle multiple definition namespaces. One could use code://github.com/edicl/hunchentoot/master/log.lisp?macro=with-log-stream&commit=0951a0df8fe93d99e6f2aa3f9612a2d6e581e84f
to refer to a particular commit. No idea what the equivalent would look like for other VCSes though.[1] json://the-domain.com/example
Would return:
{"json":"data"}
[2] thing://ip-address/exampleIn this case, it returns JSON for the sake of readability, so:
{"name":"car","speed":88,"location":"1985"}What would the advantage of json: be over Content-Type: TYPE+json?
It's a little easier to see that iot:UUID might indicate something like 'over any number of protocols, over any number of networks, please contact this device in my locality' or somesuch.
We'll release Ruby when we can do it almost as well as Go (e.g., https://sourcegraph.com/github.com/golang/go/-/def/GoPackage...).
P.S. Sourcegraph supports semantically linking to CSS as well: https://sourcegraph.com/sourcegraph/sourcegraph/-/def/basic-....
Then the interface could look like tinyurl (anonymously paste a github link, get a sourcegraph link in return).
Bonus points if it simply redirects you to the new line number on GitHub's master.
It's a great idea to make a little app to get a permalink, too!
And what's more, the Chrome extension actually adds # fragment URLs to github.com that are semantically meaningful, just like on Sourcegraph.
If the idea is to just expose reusable functions, you can take a look at https://algorithmia.com/