this is potentially an amazing idea, especially for those of us who work in polyglot systems. However, a search as simple as "queue in java" returns no result?
Idea is good, but search does not take into account language specifics. I mean same keywords do not mean same things in different languages. For instance, for and foreach are one and the same in Python (actually there is no for, just foreach named for), so if look for Python version of C#'s foreach I find nothing.
I actually have something in place which handles some cases of differences in keywords across languages. For example, searching for "dictionary in java" would return a HashMap.
I guess I didn't account the specific "foreach" keyword with C# (I have it as "for each"), good catch!
Hey HN, I'm the developer behind SyntaxDB. This feedback is good and I encourage people to keep it coming!
A lot of responses will be about "there's no result for x". You're right, there isn't nearly as much content on the site as I'd like there to be!
The content is actually hand written, and as of right now focuses on the very basic programming fundamentals common across all of the languages. The plan is to triple the amount of content in the database (adding DS, special classes, parsing, etc.), and eventually open up the database to outside contributions.
Good to know, I was coming to say something about smart pointers in C++ and a few other things I tried with no results.
Not sure how you're doing the querying but when I dropped the "smart" from "C++ smart pointers" it did return a result. Does every word in the search have to match then? I'd have thought, similar to Google, that it would return results where at least some of the search keywords matched even if they all don't.
Anyway, it looks like a good start. Even for people who already know a lot about programming it should be really useful for those times when you know what you need but just can't quite remember the full syntax of something.
Yep, that has to do with the full-text search engine (Solr). There's definitely some optimizing to do, I definitely don't want additional words throwing off the search!
It would be very awesome to have this backend data user-contributed, makes the burden of adding and improving a lot less on you. I'm looking through the sections and see lots of little tiny things that would be a quick PR on github, and I'm sure there are tons of people who'd help out.
How do you plan to compare and compete with other projects such as Stack Overflow documentation (currently in closed beta iirc) which, as far as I can see, offers the same functionality, but a larger user base?
SO documentation looks very cool actually, and it'll be interesting to see how it turns out. I'm all for documentation being easier across all services, and I care a lot more about having this problem solved rather than pushing SyntaxDB to compete with existing services.
With that being said, I think the current integrations and the ones planned ahead will continue to make SyntaxDB a good option, even if other sites try a similar idea.
Glad you like it! When I designed the page, I thought it would look best if the code sections were split up. Interesting feedback, I'll get some other people's thoughts on this later.
Don't try to explain basic concepts in all languages. Better make sure that the languages you have are covered for as much as possible. Then add other languages.
I'd love to see syntax examples for objective-block usage. I swear I go to fuckingblocksyntax.com every few days, but it still doesn't have any examples.
I think this would be great to open up to the community to maintain. Maybe you approve it initially, and eventually come up with a system for community approval.
Ideally to me this is part of the editor. I use Visual Code + Go.
I think there is still a lot of improvement possible for the help that the editor (plus tools) can offer. Much more (and more intelligent !) help and info to be shown while I type or move around in code. At the very least instantly show parameter types plus full docs on every function my cursor is on. Visual Code does a good job with the Go plugin but it could be faster. And there is only so much a plugin can do.
If AI is really the future of coding then it least at some point it should be more helpful before it takes over...
Right now, this isn't really any better than looking at an individual language's site for syntax, this just offers a common user interface. For example, the site has no idea what a list comprehension is, yet that's a fundamental component of python.
I think a transpiler would be absolutely awesome -- even if it only works on curated code samples on the site. Something that shows how a piece of code can be expressed in many different languages. This would be extremely useful for things like Regular Expressions (also, no results found for regular expressions on the site), which are in just about every language, but are treated very differently.
Personally, I think that's your killer idea. It will be damn hard to do, but if you can make it work, I think you'll end up with a lot of visitors. Knowing the language idioms is key to understanding a language.
Yeah, I mean I use that word because it conveys the result I'd like to see.
A syntax database is not terribly useful. A concept database is where the real value is. The idea is that a language is much more than just raw syntax. C++, Python, and awk are all so fundamentally different that explaining the differences in terms of syntax is ultimately worthless.
Even something like "array in C++" vs. "arrays in python" is not very valuable because they really mean totally different things. There's a lot of unknown-unknowns for a Python programmer whose never seen C++ code in their life. They would never think that arrays are fixed length and accept only one data type because lists in Python have neither limitation, likewise, a C++ programmer might be looking something to that behaves like std::vector not understanding that Python lists are perfectly appropriate.
It would be perfectly acceptable to have people write the "same" (ideally, non-trivial) code in different languages and link them together. In fact, that's probably what they should seek to do.
You might not see this but I totally get what you mean. It'd be interesting to see something that broke programming down to that sort of core level. I'm sure it exists somewhere in some CS lab right?
Is there any way to suggest improvements, or heck, raise PRs, instead of using the feedback button?
For example, the for in Python should include an example using enumerate too which I'd be happy to add and contain some additional docs on xrange vs range in Python 2 vs Python 3.
I would suggest using "learn x in y minutes" [1] if you need to lookup syntax for something. It doesn't feature the "for loop in java" search function, but it has more languages than this tool, as well as tools like vim, git, tmux, with many files having multiple natural language translations. It is also community driven, so if there is something missing it is only a pull-request away.
It's not a bad idea but it seems a bit sparse at the moment even in the languages it does support. Search for lambda does give anything about Java 8's lambda syntax, and search for annotation returns nothing at all.
- include the code-highlighted syntax block in the typeahead suggestions.
- When i hit 'enter' on a typeahead suggestion, send the user to the page instead of just filling the input.
This is a very good idea. As others have said, and the creator acknowledged, there isn't a lot of content yet. Community contribution would be very cool.
I'm not sure if I have a good idea here or not, but focusing on older and/or more esoteric languages is a potential niche. For instance, and these are real examples, maybe I've inherited some SAS code with a nasty DATA step and I don't really know how a MERGE works. Or COBOL. I always have ridiculous COBOL things to google.
As someone else pointed out, though, I think you need some cross-search between idioms. I might not know what a SAS DATA MERGE is, but if I look for a SAS join, tell me how to do it in PROC SQL or the DATA step.
A while back, there was a service on the front page that was a combination of search engine for code, static analysis, and git repository browser. The initial implementation was for Golang only.
Does anybody remember what that project was? Does it still exist?
Slightly OT, sorry. This project just reminded me of it.
Sourcegraph CEO here. Yep, Sourcegraph (https://sourcegraph.com) is a fast, global, semantic code search & cross-reference engine. It helps developers discover and understand code. It fits the description above. :)
We support Go and Java now. More languages are coming soon (JavaScript, Python, etc.).
Good start but -- some C++ stuff is wrong, e.g. in the bit on friend functions, a member function prototype is written with an empty block instead of a terminal ";". Subtle, but you know. Also, more subjectively, std::string is described as immutable, but with no further discussion about what that means or how that might work.
Just sayin. Frankly I like how it's not Wikipedianishly drowning in citations and/or demands for same -- but how does it get updated? I immediately tried to expand on those two issues I mentioned but there was no sort of UX recourse for my pedantic urges (FWIW)
Thanks for pointing that out! As of right now, it all gets updated manually (there's an internal CMS I built and use). As of right now, when people point out corrections they do so via feedback form, and I update accordingly (if I can verify it). Not the greatest but it's what's in place for the time being.
It'll later be open for others to provide new concepts and corrections.
73 comments
[ 0.23 ms ] story [ 143 ms ] threadno results?
http://imgur.com/0cJTqz3
I guess I didn't account the specific "foreach" keyword with C# (I have it as "for each"), good catch!
A lot of responses will be about "there's no result for x". You're right, there isn't nearly as much content on the site as I'd like there to be!
The content is actually hand written, and as of right now focuses on the very basic programming fundamentals common across all of the languages. The plan is to triple the amount of content in the database (adding DS, special classes, parsing, etc.), and eventually open up the database to outside contributions.
Additional languages are coming too!
Not sure how you're doing the querying but when I dropped the "smart" from "C++ smart pointers" it did return a result. Does every word in the search have to match then? I'd have thought, similar to Google, that it would return results where at least some of the search keywords matched even if they all don't.
Anyway, it looks like a good start. Even for people who already know a lot about programming it should be really useful for those times when you know what you need but just can't quite remember the full syntax of something.
Love the idea!
With that being said, I think the current integrations and the ones planned ahead will continue to make SyntaxDB a good option, even if other sites try a similar idea.
``` In [1]: s = {}; type(s) Out[1]: dict ```
I think there is still a lot of improvement possible for the help that the editor (plus tools) can offer. Much more (and more intelligent !) help and info to be shown while I type or move around in code. At the very least instantly show parameter types plus full docs on every function my cursor is on. Visual Code does a good job with the Go plugin but it could be faster. And there is only so much a plugin can do.
If AI is really the future of coding then it least at some point it should be more helpful before it takes over...
https://syntaxdb.com/about
I think a transpiler would be absolutely awesome -- even if it only works on curated code samples on the site. Something that shows how a piece of code can be expressed in many different languages. This would be extremely useful for things like Regular Expressions (also, no results found for regular expressions on the site), which are in just about every language, but are treated very differently.
Personally, I think that's your killer idea. It will be damn hard to do, but if you can make it work, I think you'll end up with a lot of visitors. Knowing the language idioms is key to understanding a language.
A syntax database is not terribly useful. A concept database is where the real value is. The idea is that a language is much more than just raw syntax. C++, Python, and awk are all so fundamentally different that explaining the differences in terms of syntax is ultimately worthless.
Even something like "array in C++" vs. "arrays in python" is not very valuable because they really mean totally different things. There's a lot of unknown-unknowns for a Python programmer whose never seen C++ code in their life. They would never think that arrays are fixed length and accept only one data type because lists in Python have neither limitation, likewise, a C++ programmer might be looking something to that behaves like std::vector not understanding that Python lists are perfectly appropriate.
It would be perfectly acceptable to have people write the "same" (ideally, non-trivial) code in different languages and link them together. In fact, that's probably what they should seek to do.
For example, the for in Python should include an example using enumerate too which I'd be happy to add and contain some additional docs on xrange vs range in Python 2 vs Python 3.
[1] https://learnxinyminutes.com/
Feature suggestions:
- include the code-highlighted syntax block in the typeahead suggestions. - When i hit 'enter' on a typeahead suggestion, send the user to the page instead of just filling the input.
I'm not sure if I have a good idea here or not, but focusing on older and/or more esoteric languages is a potential niche. For instance, and these are real examples, maybe I've inherited some SAS code with a nasty DATA step and I don't really know how a MERGE works. Or COBOL. I always have ridiculous COBOL things to google.
As someone else pointed out, though, I think you need some cross-search between idioms. I might not know what a SAS DATA MERGE is, but if I look for a SAS join, tell me how to do it in PROC SQL or the DATA step.
Keep going, I think this is very cool.
Does anybody remember what that project was? Does it still exist?
Slightly OT, sorry. This project just reminded me of it.
We support Go and Java now. More languages are coming soon (JavaScript, Python, etc.).
SyntaxDB is super cool, BTW.
Definitely would use Sourcegraph with Python support.
Just sayin. Frankly I like how it's not Wikipedianishly drowning in citations and/or demands for same -- but how does it get updated? I immediately tried to expand on those two issues I mentioned but there was no sort of UX recourse for my pedantic urges (FWIW)
It'll later be open for others to provide new concepts and corrections.
https://syntaxdb.com/reference/search?utf8=%E2%9C%93&search=...
I wish it was more complete though!
"No results found for bash if" https://syntaxdb.com/reference/search?utf8=%E2%9C%93&search=...
"for loop in bash" no results :-(