Strange error message from collections/sets.nim

2020-11-26 Thread lscrd
> Indentation's purpose is to show scope, I'm uncertain if alignment even makes > more readable code. No, indentation is certainly not a way to indicate scoping as in old languages, such as Pascal, an IF, a FOR or a WHILE statement doesn’t create a new scope. Even in Python an if, a for or a wh

Strange error message from collections/sets.nim

2020-11-25 Thread slonik_az
> @Araq: You have to use gofmt to get it or you need to be conciously aware of > tabs vs spaces all the time. Excuse me, but I prefer to spend more time on > the algorithmic aspects of my code. Modern editors are surprisingly good at keeping this complexity away from you. VS-code with Golang ex

Strange error message from collections/sets.nim

2020-11-25 Thread Araq
> Of course a good editor could fix that... Well I'm not gonna change the language for people who prefer to use broken tools, sorry. But there is a good alternative: Let's focus our efforts on a standard tree format for programming languages. We can then store code as trees on the disk and eve

Strange error message from collections/sets.nim

2020-11-25 Thread Araq
> Nim's hard choice of "two spaces per indent" is not helping its adoption. It > might seem as a pet peeve but for new Nim users with experience in other > languages it can be a serious irritation. There is no such "hard choice" and there is no evidence whatsoever that it hinders its adoption.

Strange error message from collections/sets.nim

2020-11-25 Thread cblake
I tried using proportional fonts for programming once. Very awkward. You are more adventurous than most. [Barely relevant, but funny.](https://forum.nim-lang.org/t/6891#43159).

Strange error message from collections/sets.nim

2020-11-25 Thread Stefan_Salewski
It's the other way round: Space key refers to the space, the empty room between two things, like two words. Tabs may be not the ideal solution for indentation, as tabs have not been really invented for it. But indentation by those tiny spaces will ever feel wrong. For people like me using a prop

Strange error message from collections/sets.nim

2020-11-25 Thread lqdev
I feel like one very important point people miss when saying tabs should be used for indentation is the fact that tabs actually have a different purpose. It's in the name: _Tabulator_. Not indentator.

Strange error message from collections/sets.nim

2020-11-25 Thread ElegantBeef
Well I never said it was useless, I just don't get the point. Indentation's purpose is to show scope, I'm uncertain if alignment even makes more readable code. Do want to say though that you can omit the `()` and just write as follows not that I suggest this. if 10 == 10 or

Strange error message from collections/sets.nim

2020-11-25 Thread lscrd
We want alignment for instance in this case: if some_long_expression and another_long_expression and another_one: Run Of course, we could use parentheses and write, using only indentation: if ( some_long_expression and another_lon

Strange error message from collections/sets.nim

2020-11-24 Thread ElegantBeef
Why is it always people say "Tabs for indenting and spaces for alignment", since when was alignment a requirement of code. "Tabs for indenting and spaces for spaces" is where it's at. I do not see any benefit of aligning code using spaces, if you want to have aligned code you can always do the b

Strange error message from collections/sets.nim

2020-11-24 Thread slonik_az
> @Stefan_Salewski: Python does or at least did allow Tabs for indentation, so > it is possible. Python 2 allowed Tabs and Spaces and their mixing. Python 3 allows Tabs and Spaces but does not allow mixing them in indentation.

Strange error message from collections/sets.nim

2020-11-24 Thread Stefan_Salewski
> Popularity and wide spread of Golang We should really not compare to Golang. Golang has not significant white space, and Golang's main reason for its popularity is that it is a child of Google. The initial fear in Nim about tabs was that mixing tabs and spaces for indentation would be very b

Strange error message from collections/sets.nim

2020-11-24 Thread slonik_az
> @Araq: Oh not that again... That never worked for any codebase I've ever seen. Popularity and wide spread of Golang is a testament that "TABs for indentation, Spaces for alignment" does work in practice. In fact, editors like VScode and Goland achieve it so transparently that many Golang coder

Strange error message from collections/sets.nim

2020-11-24 Thread cblake
Some more details here to support @Araq's point and [links](https://forum.nim-lang.org/t/2105) to [prior discussion](https://forum.nim-lang.org/t/5943). This really does seem like an editor question, though. The only reason this style might be attractive in the first place is because most edito

Strange error message from collections/sets.nim

2020-11-24 Thread Araq
> We have really discussed that topic enough in the last 5 years. Yeah, I'm waiting for 5 years for an answer why your editor cannot turn tabs into spaces.

Strange error message from collections/sets.nim

2020-11-24 Thread Stefan_Salewski
> Use an editor that replaces tabs with whitespace. We have really discussed that topic enough in the last 5 years. For your point: Our intention is not to make the TAB key work. We regard tabs as the native, flexible entity for indentation, we would like that tabs survive in the code base. And

Strange error message from collections/sets.nim

2020-11-24 Thread solo989
Use an editor that replaces tabs with whitespace.

Strange error message from collections/sets.nim

2020-11-24 Thread Stefan_Salewski
> Oh not that again... That never worked for any codebase I've ever seen. That's what people said about significant whitespace until Python and a few others proved that its works fine. > constant friction when editing code ("oh no, I pressed a space, must undo and > use a tab") For me it is th

Strange error message from collections/sets.nim

2020-11-24 Thread Araq
> TABs for indentation, spaces for alignment. Oh not that again... That never worked for any codebase I've ever seen. Compressing 8 spaces with a tab was a common setting for emacs (iirc?) so in practice I was stuck for good with tab = 8 spaces. But even if it would work, it would be a constant

Strange error message from collections/sets.nim

2020-11-23 Thread slonik_az
> @HJarausch: Oh well, I have coded more than a million lines of code in more > than a dozens of programming languages. I have been teaching Pascal/C++ for > more than 3 decades at a university. ... So one develops one's own style. I cannot brag of writing 1M LOCs :-) but been professionally pro

Strange error message from collections/sets.nim

2020-11-23 Thread HJarausch
That was one of the reasons they have replaced their parser by a recursive descend parser.

Strange error message from collections/sets.nim

2020-11-23 Thread slonik_az
For quite a long while C++ required space between closing `>` in nested templates like this `Foo >`. Compact version `Foo>` was not standards compliant because `>>` is right-shift operator.

Strange error message from collections/sets.nim

2020-11-23 Thread Araq
Given that `echo(1, 2)` and `echo (1, 2)` are two completely different things in Nim (and yet quite intuitive IMHO) these warnings -- if doable at all -- would only be annoying. Tools cannot replace understanding.

Strange error message from collections/sets.nim

2020-11-23 Thread HJarausch
Oh well, I have coded more than a million lines of code in more than a dozens of programming languages. I have been teaching Pascal/C++ for more than 3 decades at a university. So one develops one's own style. And it's just a matter of style. I can remember only very few places where white spac

Strange error message from collections/sets.nim

2020-11-23 Thread spip
Well,ifyo ulik etodro pwhi tespac esatra ndom,Ni mwo n'tbeyo urfri end... Like in many languages!;-)

Strange error message from collections/sets.nim

2020-11-23 Thread slonik_az
As I learned from my own trials and errors, Nim is a white-space-sensitive language that likes white space consistency. After a bit of practice I do not feel that limits me in any way.

Strange error message from collections/sets.nim

2020-11-23 Thread HJarausch
Thanks, an embarrassing error, but why didn't this get flagged? Now the line var ChkPoints= initTable[int, (HashSet[T2int], DigSet, int)] () Run gives Error: type mismatch: got but expected one of: proc (initialSize: int): Table[system.int, (HashSet[BUG.T2int], DigSe

Strange error message from collections/sets.nim

2020-11-23 Thread miran
Remove the space between `]` and `(`: `initTable[int, (HashSet[T2int], DigSet, int)]()` But this will continue to bite you in the future because of your sloppy writing style when it comes to whitespace: you have it in places where you shouldn't, you don't have it where it would be nice to have,

Strange error message from collections/sets.nim

2020-11-23 Thread HJarausch
It turns out that Nim has problems with the blank before () in var ChkPoints= initTable[int, (HashSet[T2int], DigSet, int)] () ^ Run That's a pity and hard to find.

Strange error message from collections/sets.nim

2020-11-23 Thread miran
Don't `include` modules. `import` them.

Strange error message from collections/sets.nim

2020-11-23 Thread HJarausch
include tables, sets type BS8 = set[int8] DigSet = array[9,BS8] T2int = tuple[f:int8,s:int8] var FreeCell:HashSet[T2int] Row_Digits : DigSet R_Cells : int var ChkPoints= initTable[int, (HashSet[T2int], DigSet, int)] ()