![]() |
|
![]() |
| The RAM limit is 32 bit Intellisense. 2^32 is 4GiB.
Edit: I take that back, this was a first-principles comment. There's a setting 'C_Cpp: Intelli Sense Memory Limit' (space included). |
![]() |
| part of what i ended up with was this:
black is the opposite extreme from what i wanted; https://black.readthedocs.io/en/stable/the_black_code_style/... explains:> If a data structure literal (tuple, list, set, dict) or a line of “from” imports cannot fit in the allotted length, it’s always split into one element per line. i'm not interested in minimizing diffs. i'm interested in being able to see all the fields of one record on one screen—moreover, i'd like to be able to see more than one record at a time so i can compare what's the same and what's different black seems to be designed for the kind of person who always eats at mcdonald's when they travel because they value predictability over quality |
![]() |
| Sure. But those are far from the only massive codebases out there, and many of the biggest are monorepos because sorta by definition they are the size of multiple projects. |
![]() |
| my cousin wrote a vt52 emulator in bash, and i was looking at a macro assembler written in bash the other day: https://github.com/jhswartz/mle-amd64/blob/master/amd64. i haven't seen a cscope written in bash, but you probably remember how the first versions of ctags were written in sh (or csh?) and ed. so there's not much limit to how far shell functions can go in augmenting your programming environment
if awk, python, or perl is accepted, the possibilities expand further |
![]() |
| I looked at Helix but since I dream in vim motions at this point (vi user since it came out) I'd have to see a 10x improvement to switch. VSCode didn't give me a 10X improvement, I doubt Helix would. |
![]() |
| I get your point, but VSCode does far more than text editing. The line between an advanced editor and an IDE gets blurry. If you look at the Wikipedia page about IDEs[1] you see that VSCode ticks off more boxes than not. It has integration with source code control, refactoring, a debugger, etc. With the right combination of extensions it gets really close to an IDE as strictly defined. These days advanced text editor vs. "real" IDE seems more like a distinction without much of a difference.
You may feel 99% certain, but you got it wrong. I have quite a bit of experience with IDEs, you shouldn't assume I use vim out of ignorance. I have worked as a programmer for 40+ years, with development tools (integrated or not) that I have forgotten the names of. That includes "real" IDEs like Visual Studio, Metrowerks CodeWarrior, Symantec Think C, MPW, Oracle SQL Developer, Turbo Pascal, XCode, etc. and so on. When I started programming every mainframe and minicomputer came with an IDE for the platform. Unix came along with the tools broken out after I had worked for several years. In high school I learned programming on an HP-2000 BASIC minicomputer -- an IDE. So I have spent more than "a couple of months in real IDEs" and I still use vim day to day. If I went back to C++ or C# for Windows I would use Visual Studio, but I don't do that anymore. For the kind of work I do now vim + ctags + ripgrep (and awk, sed, bash, etc.) get my work done. At my very first real job I used PWB/Unix[2] -- PWB means Programmer's Work Bench -- an IDE of sorts. I still use the same tools (on Linux) because they work and I can always count on finding a large subset of them on any server I have to work with. I don't dislike or mean to crap on IDEs. I have used my share of IDEs and would again if the work called for that. I get what I need from the tools I've chosen, other people make different choices, no perfect language, editor, IDE, what have you exists. [1] https://en.wikipedia.org/wiki/Integrated_development_environ... |
![]() |
| And especially in large monorepos anything that understands the code can become quite sluggish. While ripgrep remains fast.
A kind of in-between I've found for some search and replace action is comby (https://comby.dev/). Having a matching braces feature is a godsend for doing some kind of replacements properly. |
![]() |
| I’ve never seen an LSP server that lets you rename “Dog” to “Wolf” where your actual class names are “Dog[A-Za-z]*”?
Do you have an example? |
![]() |
| Only thing I can recommend is using C# (obviously not always possible). Never had an issue with these functions in Visual Studio proper no matter how big the project. |
![]() |
| > look! i already told you! i deal with the god damned customers so the engineers don't have to! i have people skills! i am good at dealing with people! can't you understand that? what the hell is wrong with you people?
(office space, https://www.youtube.com/watch?v=hNuu9CpdjIo) look, lucumo, i'm sure you have excellent people skills. which is why you're writing five-paragraph power-trip-fantasy comments on hn about laughing in people's faces as you demonstrate your undeniable dominance over them, then take pity on them. but i'm not sure those comments really represent a contribution to the conversation about code greppability; they're just ego defense. you probably should not have posted them |
![]() |
| Honestly, in my 18 years of software development, I haven't "greped" code once.
I only use grep to filter the output of CLI tools. For code, I use my IDE or repository features. |
![]() |
| Definitely true when you can use static typing.
Unfortunately sometimes you can't, and sometimes you can but people can't be arsed, so this is still a consideration. |
![]() |
| >I tried a good IDE recently: Jetbrains IntelliJ
Having dealt with IntelliJ for 3 years due to education stuff - I laughed out here. Even VS is better than ideaj. |
![]() |
| The thing is, so many people are weirdly obsessed with never using any other tools besides full-text search. As if using useful tools somehow makes them a lesser programmer or something :) |
![]() |
| Yes, full-text search is a great fallback when everything else fails. But in the use cases listed at the beginning of the article it's usually not needed if you have proper tools |
![]() |
| This reminds me of the substitution mode of Tim Pope's amazing vim plugin [abolish](https://github.com/tpope/vim-abolish?tab=readme-ov-file#subs...)
Basically in vim to substitute text you'd usually do something with :substitute (or :s), like: :%s/textToSubstitute/replacementText/g ...and have to add a pattern for each differently-cased version of the text. With the :Subvert command (or :S) you can do all three at once, while maintaining the casing for each replacement. So this: textToSubstitute TextToSubstitute texttosubstitute :%S/textToSubstitute/replacementText/g ...results in: replacementText ReplacementText replacementtext |
![]() |
| Also just realised while looking at the docs it works for search as well as replacement, with:
:S/textToFind matching all of textToFind TextToFind texttofind TEXTTOFIND But not TeXttOfFiND. Golly! |
![]() |
| In vim, I believe there's a setting that you can flip to make search case sensitive.
In my setup, `/foo` will match `FoO` and so on, but `/Foo` will only match `Foo` |
![]() |
| Yeah, that’s one type.
Another is for turning soil at a small scale by hand (also called a cultivator, I think). But they all have somewhat long prongs. |
![]() |
| As far as I understood, it was part of the language before.
The german equivalent of the word would be probably "greifbar". Being able to hold something, usually used metaphorically. |
![]() |
| Could I suggest that greppbarhet is more precisely translated as “the ability of being understood”?
(Norwegian here. Our languages are similar, but we miss this one.) |
![]() |
| In English that association is going to depend a lot on one's accent; until now I've never associated grep-ing with anything other than using grep! (But, equally, that might just be a me thing.) |
![]() |
| It doesn’t sound anything like grip in my accent but for some reason the association has always been there for me. Grabbing or ripping parts from the file. |
![]() |
| Tangential: I love it when UIs say "1 object" and "2 objects". Shows attention to detail.
As opposed to "1 objects" or "1 object(s)". A UI filled with "(s)", ughh |
![]() |
| I routinely spot 3-line prints with the string on its own line in our code. Even for cases where the string + print don't even reach the 80 character "limit" |
![]() |
| This is world autoformatters have wrought. The central dogma of the autoformatter is that "formatting" is based on dumb syntactic rules with no inflow of imprecise human judgements. |
![]() |
| Not the whole file, but sufficiently long un-line-breakable code in a complex statement can cause rustfmt to give up on trying to format that statement. That's a known issue that needs fixing. |
![]() |
| Golang has a similar property as a side-effect of the following design decision.
Taken from https://go.dev/doc/faqThe "top-level declarations" in source files are exactly: package, import, const, var, type, func. Nothing else. If you're searching for a function, it's always going to start with "func", even if it's an anonymous function. Searching for methods implemented by a struct similarly only needs one to know the "func" keyword and the name of the struct. Coming from a background of mostly Clojure, Common Lisp, and TypeScript, the "greppability" of Go code is by far the best I have seen. Of course, in any language, Go included, it's always better to rely on static analysis tools (like the IDE or LSP server) to find references, definitions, etc. But when searching code of some open source library, I always resort to ripgrep rather than setting up a development environment, unless I found something that I want to patch (which in case I set up the devlopment environment and rely on LSP instead of grep to discover definitions and references). |
![]() |
| I'm not so sure about greppability in the context of Go. At least at Google (where Go originates, and whose style guide presumably has strong influence on other organizations' use of the language), we discourage "stuttering":
> A piece of Go source code should avoid unnecessary repetition. One common source of this is repetitive names, which often include unnecessary words or repeat their context or type. Code itself can also be unnecessarily repetitive if the same or a similar code segment appears multiple times in close proximity. https://google.github.io/styleguide/go/decisions#repetitive-... (see also https://google.github.io/styleguide/go/best-practices#avoid-...) This is the style rule that motivates the sibling comment about method names being split between method and receiver, for what it's worth. I don't think this use case has received much attention internally, since it's fairly rare at Google to use grep directly to navigate code. As you suggest, it's much more common to either use your IDE with LSP integration, or Code Search (which you can get a sense of via Chromium's public repository, e.g. https://source.chromium.org/search?q=v8&sq=&ss=chromium%2Fch...). |
![]() |
| Zipf's law, right - these rules are a formalization of our brain's functionality with language.
Of course, with enough code, someone does everything. |
![]() |
| I like using l for logger and db for database client/pool/handle even if there's a wider scope. And if the bulk of a file is interacting with a single client I might call that c. |
![]() |
| Golang gets zero points from me because function receivers are declared between func and the name of the function. God ai hate this design choice and boy am I glad I can use golsp. |
![]() |
| that's going to find all the functions that take an argument named lart or of a lart type too, but it also sounds like a thing i really want to try |
![]() |
| C# did this for extension methods and it Just Works. You just add the "this" keyword to a function in a pure-static class and you get method-like calling on the first param of that function. |
![]() |
| c's macro system is weak on purpose, based on, i suspect, bad experiences with m6 and m4. i think they thought it was easier to debug things like ratfor, tmg, lex, and (much later) protoc, which generate code in a more imperative paradigm for which their existing debugging approaches worked
i can't say i think they were wholly wrong; paging through compiler error messages is not my favorite part of c++ templates. but i have a certain amount of affection for what used to be called gasp, the gas macro system, which i've programmed for example to compute jump offsets for compiling a custom bytecode. and i think m4 is really a pathological case; most hairy macro systems aren't even 10% as bad as m4, due to a combination of several tempting but wrong design decisions. lots of trauma resulted so when they got a do-over they eliminated the preprocessor entirely in golang, and compensated with reflection, which makes debugging easier rather than harder probably old hat to you, but i just learned last month how to use x-macros in the c preprocessor to automatically generate serialization and deserialization code for record types (speaking of cobol): http://canonical.org/~kragen/sw/dev3/binmsg_cpp.c (aha, i see you're linking to a page that documents it) |
![]() |
| Yes but that’s an anti pattern. Arrow functions aren’t there to look cool, they’re how you define lambdas / anonymous functions.
Other than that, functions should be defined by the keyword. |
![]() |
|
This is a great point.One more: Debugging `.map()` is also much harder than a for loop. |
![]() |
| Another benefit of using for instead of array fns is that it is easy to add await keyword should the fn become async.
But many teams will have it as a rule to always use array fns. |
![]() |
| As an aside: It’s way less ergonomic, but you likely want `Promise.allSettled` rather than `Promise.all` as the first promise that throws aborts the rest. |
![]() |
| I don't like using them everywhere, but they're very handy for inline anonymous functions.
But it really pains me when I see export const foo = () => {} instead of export function foo() {} |
![]() |
| I did not say I do not use what is avaiable, but this debate is about in general having your code in a shape that simply searching for strings work. |
![]() |
| In terms of C, that's one reason I prefer the BSD coding style:
int foo(void) { } vs the Linux coding style: int foo(void) { } The BSD style allows me to find function definitions using git grep ^foo. |
![]() |
| Although in rust, function like macros make it super hard to trace code. I like them when I am writing the code and hate then when I have to read others macros. |
![]() |
| Yes. Not everyone uses or likes an IDE. Also, when you lean on an IDE for navigation, there is a tendency to write more complicated code, since it feels easy to navigate, you don't feel the pain. |
![]() |
| The Rust compiler doesn't produce warnings out of zealotry, but rather as a consequence of pre-1.0 historical decisions. Note that Rust doesn't use any syntax in pattern matching contexts to distinguish between bindings and enum variants. In pre-1.0 versions of Rust, this created footguns where an author might think they were matching on an enum, but the compiler was actually parsing it as a catch-all binding that would cause any following match arms to never be executed. This was exacerbated by the prevailing naming conventions of the time (which you can see in this 2012 blog post: https://pcwalton.github.io/_posts/2012-06-03-maximally-minim... (note the lower-cased enum variants)). So at some point the naming conventions were changed in an attempt to prevent this footgun, and the lint was implemented to nudge people over to the new conventions. However, as time went on the footgun was otherwise fixed by instead causing the compiler to prioritize parsing enum variants rather than bindings, in conjunction with other errors and warnings about non-exhaustive patterns and dead code (which are all desirable in their own right). At this point it's mostly just vestigial, and I highly doubt that anybody really cares about it beyond "our users are accustomed to this warning-by-default, so they might be surprised if we stopped doing this".
|
For the past decade-plus I have mostly only searched for user facing strings. Those have the advantage of being longer, so are more easily searched.
Honestly, posts like this sound like the author needs to invest some time in learning about better tools for his language. A good IDE alone will save you so much time.