9 ms·
SyntaxDB – Quickly look up syntax for programming languages
- adontz 10y agoIdea 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.
- anthnguyen94 10y agoI 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!
- taf2 10y agohttps://syntaxdb.com/reference/search?utf8=%E2%9C%93&search=Rust https://syntaxdb.com/reference/search?utf8=%E2%9C%93&search=... no results?
- marxidad 10y agoRight now it's only Java, C, C++, C#, Python, Ruby, JavaScript, Swift, and Go.
- kherkeladze 10y agoSure http://imgur.com/0cJTqz3 http://imgur.com/0cJTqz3
- davydka 10y agoNice site! You should put the list of languages up front so we all stop pointing out what's missing.
- quantum_nerd 10y agothis 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?
- anthnguyen94 10y agoHey 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. Additional languages are coming too!
- smhenderson 10y agoGood 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.
- anthnguyen94 10y agoYep, 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!
- joelg236 10y agoIt 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. Love the idea!
- anthnguyen94 10y ago
- ruffrey 10y agoI'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.
- quaffapint 10y agoI 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.
- alexkavon 10y agoAgreed. A moderation approach and applied merit could foster a healthy community as well as innovation with this.
- anthnguyen94 10y agoThat's the plan! Just a way to allow community contributions, provide incentives while maintaining the quality of content.
- Gys 10y agoIdeally 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...
- smhenderson 10y agoOn of the items on his "Future" list is creating plugins for editors. https://syntaxdb.com/about https://syntaxdb.com/about
- mywittyname 10y agoRight 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.
- thenipper 10y agoWould a transpiler kind of be like rosetta code?
- mywittyname 10y agoYeah, 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.
- thenipper 10y ago
- deleted 10y ago[deleted]
- daenney 10y agoIs 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.
- stepvhen 10y agoI 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. [1] https://learnxinyminutes.com/ https://learnxinyminutes.com/
- apatap 10y agoWhat is the business model behind this offering?
- deleted 10y ago[deleted]
- aardvark179 10y agoIt'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.
- divyekapoor 10y agoBash... sorely missing and sorely needed. :)
- blairanderson 10y agoPretty darn cool! 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.
- SmellTheGlove 10y agoThis 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. Keep going, I think this is very cool.
- robbles 10y agoA 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.
- nepalisaathi 10y agoDo you mean Sourcegraph? https://sourcegraph.com/ https://sourcegraph.com/
- sqs 10y agoSourcegraph CEO here. Yep, Sourcegraph (https://sourcegraph.com 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.). SyntaxDB is super cool, BTW.
- robbles 10y agoAwesome - looking forward to trying it out again! Definitely would use Sourcegraph with Python support.
- rad_gruchalski 10y agoI see only an empty white page on the iPhone.
- sqs 10y agoThanks for letting me know. I just emailed you.
- robbles 10y agoYes! That's the one - thanks!
- 10y ago
- fish2000 10y agoGood 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)
- anthnguyen94 10y agoThanks 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.
- kevlar1818 10y ago"No results found for list comprehension in python" https://syntaxdb.com/reference/search?utf8=%E2%9C%93&search=list+comprehension+in+python https://syntaxdb.com/reference/search?utf8=%E2%9C%93&search=...
- bbeausej 10y agoVery good idea, though usually a simple google search will provide good information. Slack integration is actually pretty cool! I wish it was more complete though! "No results found for bash if" https://syntaxdb.com/reference/search?utf8=%E2%9C%93&search=bash+if https://syntaxdb.com/reference/search?utf8=%E2%9C%93&search=...
- jeroneemou 10y agoIt does not work ... https://syntaxdb.com/reference/search?utf8=%E2%9C%93&search=php+foreach https://syntaxdb.com/reference/search?utf8=%E2%9C%93&search=...
- brazzledazzle 10y agophp isn't in the list of languages it supports.
- jv22222 10y agoI noticed that and was wondering why php is not supported :/
- k2xl 10y agoThe one language that I always have to look up how to do a for loop for is bash. "for loop in bash" no results :-(
- anthnguyen94 10y agoSo many people (including myself at times LOL) have asked for Bash. It'll be on there soon enough!
- geon 10y agoI have used http://fuckingblocksyntax.com http://fuckingblocksyntax.com a lot.
- taesu 10y agofailed finding list comprehension in Python
- theseoafs 10y agoThree rather simple queries I ran that turned up with nothing: do notation in haskell with python function pointer c
- raimue 10y agoforeach python
- gresrun 10y agoobjective-c blocks blocks in objective-c
- anthnguyen94 10y agoThe site doesn't actually support Haskell or Obj-C atm (will in the future). I also need to improve the search engine to handle queries with additional words that might give a null result, as well as words like "foreach" (that has to do with the database). This will be fixed very soon. It is bad that there are missing concepts, and I'm fully aware that this isn't even close to complete. The goal in the future is to have as few null result queries as possible. I actually make note of queries that don't provide results so I'm glad everyone's making these known, it'll only make the database better in the future!
- theseoafs 10y agoTalking about C, not objective C. :)
- anthnguyen94 10y agoWas addressing the other commenter too! Hehe
- davydka 10y agoI tried typing elixir and erlang. No results.
- ndesaulniers 10y agothere's no pass by reference in C! https://syntaxdb.com/ref/c/pass-by-ref https://syntaxdb.com/ref/c/pass-by-ref I'd recommend const pointers, maybe function pointers, arrays of function pointers. For JS, I'd recommend instanceof.
- zwilliamson 10y agoBash is a go to scripting language for most. It would be great to see it on here.
- dendory 10y agoI made https://dendory.net/coding https://dendory.net/coding a while back as a cheatsheet of syntax between languages.
- jkoudys 10y agoI like this site, but i'm uncomfortable with it for the same reason w3schools is such a steaming pile. It can be more dangerous to project authority but not actually be accurate. I don't have to look for long to find inaccurate statements, e.g. the page that describes "for of" in ecma states that order is not guaranteed, when the order of an `of` is however the iterator is defined for that collection. e.g. `for (const a of (function*() { yield 1; yield 2; })())` is certainly going to have an order. I think they were just confusing it with for in.
- aneil 10y agoI used the pattern suggested, but came up with no useful results after 3 tries: * "channels in go" (no result) * "mutex"(no result) * "generator in python" (returned a page describing the Python programming language)