I did a quick re-read, I'm assuming the edit was just the addition of the second part, and no fundamental changes in the first?Schol-R-LEA wrote:Damn, I was in the middle of editing my post again, so I'm not sure if you saw the part about how grep works vs. how the IDE's search would presumably work. Sorry for that. The point about how regex compilers operate may be relevant.
Also, does anyone have any comment on my post about Oberon and its solution to the question?
Given how often the edit problems happen to you, have you considered not doing this type of "changes" not by editing, but by posting? =)
As a user of a hammer, I don't care how it's made. As the manufacturer I do.Schol-R-LEA wrote: I think that much of this argument comes down to matters of perspective. LtG is thinking in terms of the high-level problem ("How do I find all instances of this function being called") while XenOS is focused in the lower-level ("what substrings in this file match the function name"). The former isn't really any 'better' than the latter, or vice versa, but they are not the same question, and do not result in the same answer.
As programmers we're often playing both parts. I have a high level task I need to complete (the what), so I have to figure out how to do that (the how).
The further away I can stay from minutia, the happier/faster/more productive I am.
I'm not sure what the distinction between "how it accomplishes ..." vs "how the algo perform" is. Is the latter in respect to performance (ie. cycle count) and not how it performs it as in how to it does it?Schol-R-LEA wrote: I would add that calling grep 'brute force' is a bit misleading, at least in terms of how it performs the search. LtG seems to be saying that it's 'brute force' with regards to how it accomplishes the objective, though, rather than how the algorithms perform.
By brute force I refer to two separate but close problems:
- it has to go thru the entire data set, when only part of it is ever relevant for any specific question
- going thru the entire data set is wasteful
Magic text doesn't allow for narrowing, it's impossible to just skip stuff. You don't even know where the next line starts (until you've read this line), let alone what it means.
To get results you need narrowing, and to do that with grep you give it (in practice flawed) understanding what that magic text means, to the extent that it gets you the results you want. Even though, at some point, the full semantic meaning was available (eg. the timestamps in logs I mentioned earlier).
I think the usual sense is that a string is just an array of bytes, and let's go thru them all would apply.Schol-R-LEA wrote: Still, it might be worth considering how a regex compiler such as grep(1) actually operates, as it isn't actually doing string searches in the usual sense at all (and I am using the word 'compiler' advisedly, as it actually generates code in a compile-and-go fashion).
Not just the IDE, the compiler will have them also. My point is that all the tools related will need them, and thus create them, I'd rather share them and take full advantage of them. I often have to use grep in IDE's because they can't do the job fully, for instance with multi-repo, and it's us, the programmers that create these problems. Just because we might want to split a repo for organizational reasons doesn't mean the IDE shouldn't be able to "hyperlink" to the definition of a function.Schol-R-LEA wrote: Also, the point about IDEs is that they aren't doing a string search, either, but some sort of table or tree lookup instead - the IDE has already analyzed the code and is working with the data structures it already has.)
I think I've been pretty vocal on it being resource-intensive, and more to the point, wasteful.Schol-R-LEA wrote: It is a good deal more sophisticated - and more resource-intensive - than either of you seem to realize. I know that this may not sound relevant, but my point is that the 'simpler' tool in question is anything but, and both of you are basing part of your argument on the same fallacy; even if you are both using it for opposing points, the fact remains that it is a fallacy.
I also don't consider grep simple, at least from the user perspective. Solar said he has grep-fu, but I think making a tool (search) complex is not the right path, and I think Google proved that. (Is that similar to Godwin's law?)