is it possible to rename a key in an orderedtable while retaining the order?

2020-08-28 Thread miran
> Note that, if the same key appears more than once, this will replace all > occurrences. > > `... result.add ` `add` for tables is (finally) deprecated and IMO shouldn't be even mentioned to beginners. You should use `[]=` instead so you don't introduce duplicate keys unintentionally. (No

is it possible to rename a key in an orderedtable while retaining the order?

2020-08-28 Thread jibal
Your code doesn't do anything like what you say you want to do; it simply removes the "cat" item and adds a "dog" item, which of course goes at the end. The OrderedTable API does not offer mutable access to the keys, so there's really no way to do what you want. You could do something like this,

nim.town is a shared domain for nim projects, developers, organizations, etc

2020-08-28 Thread cricket
@moigagoo pointed `packages`, `norman`, `loco`, and `moigagoo`

is it possible to rename a key in an orderedtable while retaining the order?

2020-08-28 Thread cricket
hey ^^)/ just a question, is it possible to rename a key in an orderedtable while retaining the order? here's what i tried first, import tables var animals = {"cat": "woof", "cow": "moo", "opossum": "his"}.toOrderedTable # i would like this order to stay

nim.town is a shared domain for nim projects, developers, organizations, etc

2020-08-28 Thread cricket
@lqdev im guessing you're the one who wanted `hayago.nim.town`? i have responded i think, have you checked your spam? if not showing up, i already have pointed `hayago.nim.town` toward your site! please follow steps 1, 2, and 3 [here](https://docs.github.com/en/github/working-with-github-pages/

Blog post about strict funcs

2020-08-28 Thread jibal
> Btw you can override the compiler's thinking with a {.noSideEffect.}: ... > block. I think that pragmas with opposite meanings depending on where they appear is confusing. I think something like {.ignoreSideEffects.} would be better.

Brainstorming ideas to improve Nim's landing page

2020-08-28 Thread sschwarzer
> Expressive: > > ... > > Know what sort of types you're looking for? Tell Nim using > [concepts](https://nim-lang.org/docs/manual_experimental.html#concepts). I don't think we should advertise a feature on the landing page that's marked as "experimental". :-)

Brainstorming ideas to improve Nim's landing page

2020-08-28 Thread sschwarzer
> Nim utilizes a Uniform Function Calling Syntax, which means whether the > variable is an int, or a object you can call procedures as if they were > member functions. Example: 10.float.pow 2 Although I've come to like UFCS, at first I was skeptical. "Some" people think that you should have one

Blog post about strict funcs

2020-08-28 Thread lscrd
This is the pragma {.noSideEffect.} for `add` which causes the error. Adding a block {.noSideEffect.} in `p` doesn’t change anything. But in fact, for now, I don’t want to make the program compile. I just want to understand the behavior. I simplified again my examples (no need for an object) an

Blog post about strict funcs

2020-08-28 Thread Araq
Btw you can override the compiler's thinking with a `{.noSideEffect.}: ...` block.

For Loop Macro Plans

2020-08-28 Thread Araq
IMHO it's high time to move them from their "experimental" status to stable.

Blog post about strict funcs

2020-08-28 Thread Araq
As I wrote, `add` for seq must be `.noSideEffect` no matter the `T`. The analysis might be "sound" as it it is, but it's too conservative. :-)

Blog post about strict funcs

2020-08-28 Thread lscrd
OK, but that doesn’t explain why my second examples compiles. We are in the same situation where an alias is created when copying a reference.

Blog post about strict funcs

2020-08-28 Thread jibal
> The compiler analysis is sound, add() is copying choices, which contains > references reachable from choices into an another storage location where they > can be mutated. But Araq just said that "Mutability via var parameter has higher priority than immutability of other parameters", and resu

Blog post about strict funcs

2020-08-28 Thread jibal
> According to the type of T a proc may be side-effect free or not. How could that not be true? Different code will be executed depending on the type. I don't think {.noSideEffect.} is checkable at the definition point by either humans or the compiler; it can only be checked at the invocation.

Blog post about strict funcs

2020-08-28 Thread lscrd
This is a rather subtile explanation. I will have to read Araq’s paper again to see where is described this behavior. But, then, there is a problem as the following program compiles without error: type Item = ref object choices: seq[Item] proc p(it

Recognizing non-ASCII characters in lexbase-based lexer

2020-08-28 Thread jibal
Note that lexbase doesn't really have much to do with lexing (scanning)--it just provides buffering that guarantees that lines don't cross buffer boundaries so that the lexer doesn't have to check whether a refill is needed on every single character, only when it needs to consume the EOL. (Note

Blog post about strict funcs

2020-08-28 Thread leorize
The compiler analysis is sound, `add()` is copying `choices`, which contains references reachable from `seq[Item]` into an another storage location where they can be mutated. I guess what this meant is that `add()` is not truly `{.noSideEffects.}` :P

Blog post about strict funcs

2020-08-28 Thread lscrd
I have been able to reproduce the error in a very simple example: type Item = ref object choices: seq[Item] proc p(item: Item): seq[Item] = result.add(item.choices) Run

Can't convert time series to / from JSON

2020-08-28 Thread SolitudeSF
1 person is entire nim community, sure

Blog post about strict funcs

2020-08-28 Thread demotomohiro
Thank you for great new feature and nice blog post! `n` parameter in `test` func in following code can be mutated via var parameter `x`. Mutability via var parameter has higher priority than immutability of other parameters? {.experimental: "strictFuncs".} type Node

Blog post about strict funcs

2020-08-28 Thread Araq
> Mutability via var parameter has higher priority than immutability of other > parameters? Correct.

Blog post about strict funcs

2020-08-28 Thread lscrd
OK, thanks. I will try to reproduce the problem in a simple example.

Blog post about strict funcs

2020-08-28 Thread Araq
> Before investigating further, I would like to know if I missed something. You didn't, this code must compile.

Brainstorming ideas to improve Nim's landing page

2020-08-28 Thread Stefan_Salewski
> do away with Nim's current motto of "efficient, expressive and elegant". I was never happy with that wording on the landing page. But it may survive on the "Features" page. Maybe?

Brainstorming ideas to improve Nim's landing page

2020-08-28 Thread leorize
For the landing page we should keep it short, the long stuff can be put into the "Features" page for example. Here's my attempt at simplifying the statement: > A language backed with state-of-the-art, research-based design and > emphasizing on speed, readability, flexibility and safety. This s

Blog post about strict funcs

2020-08-28 Thread lscrd
I installed last development version and did some tests. This is quite impressive! But I encountered a strange error in one case. It occurred in system.add with the message: /home/xxx/.choosenim/toolchains/nim-#devel/lib/system.nim(1216, 6) Error: 'add' can have side effects an

Can't convert time series to / from JSON

2020-08-28 Thread Lomar
...and this is why Nim community (and the language by extension) will never be taken seriously by the big boys (aka workplaces).

We should make it simpler for authors to have their blog featured on the Nim front page.

2020-08-28 Thread leorize
Pester @Araq about it enough and he will delegate someone to do the task :P

Can't convert time series to / from JSON

2020-08-28 Thread enthus1ast
I personally think, when crossposting then link to the different pages, so others may have it easier to find a solution

For Loop Macro Plans

2020-08-28 Thread cblake
Correct me if I am wrong, but for loop macros remain "experimental" after 2.5 years in action and there is no explicit plan for upgrading that status. The feature needs to be activated with `{.push experimental: "forLoopMacros".}` or adding the `--experimental` compiler switch to a nim.cfg/comma

Can't convert time series to / from JSON

2020-08-28 Thread Stefan_Salewski
Yes sorry, my assumption was that there is someone at stackoverflow who tries to damage the Nim language with a flood of questions. And indeed user names differ? Unfortunately Nim is a weak target due to small user base, so question flood can generate the impression that language is death, and

Can't convert time series to / from JSON

2020-08-28 Thread alexeypetrushin
> the issue with the json module is you can specify % to convert TO json, but > afaik there is no way to automatically convert it back. So you unfortunately > cannot specify the inverse function of %. It seems like overriding `init_from_json` works, although it's not documented.

Nimble package structure and interop changes

2020-08-28 Thread cblake
I agree some other compile time error is likely and agree this new warning/error is only a nice-to-have...I thought I said that elsewhere but I cannot find it. Trying to keep it brief. :-) Anyway, the core point is optionality of package qualification unless it's necessary, just like module qua

Can't convert time series to / from JSON

2020-08-28 Thread alexeypetrushin
> Are you in some way related to the strange guy that pollutes stackoverflow > with Nim questions? I asked question on StackOverflow and after a day when there were no answer copied it to this forum. The copies of answers on StackOverflow were posted later. Also, I was not sure what is the pro

Nimble package structure and interop changes

2020-08-28 Thread zahary
Please be aware that @bobeff's work on reforming Nimble to support lockfiles addresses some of the presented issues and it's already quite close to completion. Please take your time to study it by examining the test cases. @bobeff is also likely to start working on better documentation quite soo

Nimble package structure and interop changes

2020-08-28 Thread Araq
Well `--path` has a strict order so what module you refer to is deterministic. We could warn about ambiguous module imports but there is little need, if the order is wrong, you import the wrong module and you get not found symbols or type mismatches.

Brainstorming ideas to improve Nim's landing page

2020-08-28 Thread federico3
I feel that the landing page and FAQ focus on what Nim is and its syntax and don't mention the language philosophy and long term goals. Something like: "Nim is ambitious project. We value state-of-the-art, research-based design over easy compromises. We strive to reach for the speed of C, the r

Nimble package structure and interop changes

2020-08-28 Thread cblake
Rather than "warning that exporting multiple packages is imprudent", the default should just be a similar reporting & resolution mechanism for name management of symbols/procs in modules. Specifically, if both `pkgA/modA` and `pkgB/modA` (or `pkgC...`) exist then the compiler tells you to qualif

Defer doesnt work with block, break and await

2020-08-28 Thread Araq
Please report bugs on github and use more of this new stuff called "structured programming".

Recognizing non-ASCII characters in lexbase-based lexer

2020-08-28 Thread Araq
Like so: const PermittedIdentifiers_In = {'a'..'z', 'A'..'Z', '\128'..'\255'} Run You can check for "valid Unicode" or "only some Unicode classes are allowed" in a postprocessing step , unicode.nim should be helpful for that.

Nimble package structure and interop changes

2020-08-28 Thread Araq
I still don't understand how backwards compatibility would be handled. By a `nimble --legacy` switch?

We should make it simpler for authors to have their blog featured on the Nim front page.

2020-08-28 Thread moigagoo
I've also suggested bounties for blog posts, and I'll shamelessly use this thread to do that again :-)

Brainstorming ideas to improve Nim's landing page

2020-08-28 Thread moigagoo
First, thank you for starting this thread. Second, I agree with most of your points, but I don't have the time to write a better copy. Third, I think one thing that would help a lot is language comparison. When you decide on whether to invest time in a language, you don't just evaluate its fea

Can't convert time series to / from JSON

2020-08-28 Thread shirleyquirk
"pollutes", "strange" Come on, dude. God forbid someone asks questions on StackBloodyOverflow Not cool

Best way to parse CSV data with the JS backend

2020-08-28 Thread halloleo
Got it. Makes sense. Will try 1.3.5 then.

Handling in-place functions efficiently

2020-08-28 Thread jibal
See

Brainstorming ideas to improve Nim's landing page

2020-08-28 Thread michy
> Nim can bootstrap > > Translation: "The Nim compiler, library, and tools are written in Nim." Exactly. The whole documentation would benefit from more 'translations' like this. It often feels like _from language-developers for language-developers_ , which however misses the vast part of t

Can't convert time series to / from JSON

2020-08-28 Thread enthus1ast
the issue with the json module is you can specify `%` to convert TO json, but afaik there is no way to automatically convert it back. So you unfortunately cannot specify the inverse function of `%`

Brainstorming ideas to improve Nim's landing page

2020-08-28 Thread jibal
> Nim can bootstrap itself (why this is in "Expressive" is beyond me). Translation: "The Nim compiler, library, and tools are written in Nim." However, that's not a distinction.

Nimble package structure and interop changes

2020-08-28 Thread wltsmrz
Have you looked into using github package registry?

Problem with template and async

2020-08-28 Thread gabbhack
Same error

Problem with template and async

2020-08-28 Thread jyapayne
For some reason, the error is just wrong. Simply putting a discard statement in front of your bottom expression works: import asyncdispatch template test: untyped = return true proc main(): Future[bool] {.async.} = test discard waitFor main()

Defer doesnt work with block, break and await

2020-08-28 Thread gabbhack
Works: (block, break, sync) Works: (block, break, asyncCheck) Works: (block, await) Nope: (block, break, await) import asyncdispatch