Best way to parse CSV data with the JS backend

2020-08-27 Thread SolitudeSF
1.4 will be a stable release with this feature included.

Recognizing non-ASCII characters in lexbase-based lexer

2020-08-27 Thread ElAfalw
So, I've been experimenting a bit with a handwritten lexer, using lexbase - in order to convert an existing project of mine which uses Flex/Bison. For example, when we encounter a character that is in `PermittedIdentifiers_Start`, the appropriate code is executed: template parseIde

Problem with template and async

2020-08-27 Thread gabbhack
Thank you, I think I can work with this. > I think it's because async proc is transformed into iterator so you can't > return immediately If this is the reason, then this code shouldn't work, but it does import asyncdispatch proc main(): Future[bool] {.async.} = retu

Best way to parse CSV data with the JS backend

2020-08-27 Thread halloleo
Just double checking: The nightly says it is version 1.3.5, but @Hlaaftana mentioned version1.4...

Can't convert time series to / from JSON

2020-08-27 Thread Stefan_Salewski
@alexeypetrushin Are you in some way related to the strange guy that pollutes stackoverflow with Nim questions? At least that guy have copied some of your forum post as to

Brainstorming ideas to improve Nim's landing page

2020-08-27 Thread ElegantBeef
In my view The current landing page for the most part could describe any language. I'd add the following to Elegant: > 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: `

Best way to parse CSV data with the JS backend

2020-08-27 Thread miran
> would the Nightly build on 2020-08-28 for branch devel Yes.

Best way to parse CSV data with the JS backend

2020-08-27 Thread halloleo
That's great. Would like to try it out. To use the current dev version would the _Nightly build on 2020-08-28 for branch devel_ (e.g. ) do?

Brainstorming ideas to improve Nim's landing page

2020-08-27 Thread leorize
### The problem One of the things I've heard a lot that bugged me when I saw discussions regarding Nim out in the wild are: * Why Nim [over ]? (often asked by newcomers) * What is different about Nim? (often asked on online forums, eg. HN, r/programming, etc.) * Why do I need macros? (oft

List with the modules of the Standard library which do not work with the JS backend

2020-08-27 Thread Hlaaftana
In case documentation isn't updated, there are tests for standard library imports for [JS](https://github.com/nim-lang/Nim/blob/devel/tests/js/tstdlib_imports.nim) and [NimScript](https://github.com/nim-lang/Nim/blob/devel/tests/test_nimscript.nims), but all these do is test that these modules

For-fun medieval rebranding

2020-08-27 Thread Hlaaftana
I normally don't care much for these "Nim branding concepts" but this looks really cool. What better to represent a language that takes old successful concepts and assimilates them than a medieval kingdom

Best way to parse CSV data with the JS backend

2020-08-27 Thread Hlaaftana
`streams` is partially implemented for JS in the Nim development version, future version 1.4, and the implemented features are enough for `parsecsv` to compile in JS. So use the current Nim development version or wait for the 1.4 release.

List with the modules of the Standard library which do not work with the JS backend

2020-08-27 Thread halloleo
I aggregated the info from this thread in a page on the Nim wiki : [Standard library and the JavaScript backend](https://github.com/nim-lang/Nim/wiki/Standard-library-and-the-JavaScript-backend) Thanks for all the input!

Best way to parse CSV data with the JS backend

2020-08-27 Thread halloleo
I have CSVs which I can access via some URLs. What is the best way to parse them in the Browser with the JS backend? I tried to read them from the URL into a stream, but the `streams` module does not seem to work under JS. Why? Nothing OS-specific here...

Nimble package structure and interop changes

2020-08-27 Thread shashlick
Inviting review and feedback from the community on some Nimble changes that are being planned for the near future. The problem statement and changes are documented on the wiki so as to retain change history. Link: [Package structure and Interop](https://github.com/nim-lang/nimble/wiki/Package-s

List with the modules of the Standard library which do not work with the JS backend

2020-08-27 Thread halloleo
> Usually the ones that work on NimScript may work on JavaScript, and theres a > list on the NimScript documentation. That is a great hint, @juancarlospaco. Thanks!

Blog post about strict funcs

2020-08-27 Thread Yardanico
Currently strictFuncs does the first - it changes the meaning of noSideEffect

Blog post about strict funcs

2020-08-27 Thread TinBryn
So I'm not completely sure what `{.experimental: "strictFuncs".}` does, it could do one of 2 things Changes the `noSideEffects` tag so that prevents mutating via references. Or, Adds a new tag to funcs that prevent mutating via references maybe call it `immutableRefs` and strictFuncs makes func

Can't convert time series to / from JSON

2020-08-27 Thread alexeypetrushin
It's possible to use manual conversion, but it's not the best approach... EconomicRatesM( name: json["name"].get_str, rates_m: json["rates_m"].get_elems.map((point) => ( point.get_elems[0].get_str, point.get_elems[1].get_float, )),

Can't convert time series to / from JSON

2020-08-27 Thread alexeypetrushin
Hi guys, I'm trying to save time series data to disk as JSON and then read it. EconomicRatesM* = object name*: string rates_m*: seq[(string, float)] Run But it won't work either way error when saving or reading, how can I fix it? The code (exec

Blog post about strict funcs

2020-08-27 Thread alexeypetrushin
+1 For gently promoting immutability by default with args and let. And for this change allowing better immutability guarantees.

Blog post about strict funcs

2020-08-27 Thread deech
TIL there is a `nim fusion`. Seems like a good idea. Is the eventual plan to migrate functionality to it from the standard library?

How to import a struct (constant)field from C

2020-08-27 Thread shirleyquirk
You're right, it doesn't, once those assignments are wrapped in a main() You're gonna like this one even less but here you go: .emit:""" typedef struct Foo{ const int a; int b; }Foo; typedef struct Foo2{ int a; int b; }Foo2

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

2020-08-27 Thread leorize
As per the title. I think this would help attracts more blog posts about Nim, and help freshen the perception that Nim is being actively developed/used. Currently authors can request to have their posts featured on [the Nim blog](https://nim-lang.org/blog.html), but I don't think most are aware

Blog post about strict funcs

2020-08-27 Thread Araq
> Can the error message be expanded to show you the alias chain that lead to > the mutation? Currently it does show a single step of the alias chain. You're probably right and it should show all steps. It's not as easy though as the algorithm doesn't even track this (it's called "path compressi

Blog post about strict funcs

2020-08-27 Thread rayman22201
This is brilliant! excellent work @Araq and @Clyyber! I have a question about the error message. Does it currently just look like the below sample? Error: 'p' can have side effects an object reachable from 'n' is potentially mutated Run Can the error message be e

How to import a struct (constant)field from C

2020-08-27 Thread shirleyquirk
I've got maybe the beginnings of a workaround. type constint {.importc: "const int".} = int Foo = object a: constint b: int let bar = Foo(a:5,b:7) #this worked for me, annoyingly. So I'm not reproducing properly echo bar var

How to import a struct (constant)field from C

2020-08-27 Thread Kiakra
Unfortunately @shirleyquirk and @Stefan_Salewski your solutions does not work :/

How to import a struct (constant)field from C

2020-08-27 Thread Stefan_Salewski
Have you tried to define an object constant and then assign that const as init value to your object var? Something like type O = object i: int const OI = O(i: 7) var o = OI echo o.i Run

Blog post about strict funcs

2020-08-27 Thread DIzer
Ok, but if we want to link previously compiled (with old behavior) library - will be an exception thrown or not?

Blog post about strict funcs

2020-08-27 Thread Araq
These should be provided as external libraries (and iirc we have some Nimble packages offering these) or added to "nim fusion". Our focus is on language development, not on libraries.

Blog post about strict funcs

2020-08-27 Thread deech
This is great! Now that mutation is being enforced more strictly will there be immutable versions of data structures with node sharing and purely functional updates?

Problem with template and async

2020-08-27 Thread mashingan
I think it's because async proc is transformed into iterator so you can't return immediately. This works import asyncdispatch template test: untyped = result = true proc main(): Future[bool] {.async.} = test() doAssert waitFor main()

How to import a struct (constant)field from C

2020-08-27 Thread Kiakra
So i have a game engine core written in c99 and i would love to use nim to make it full-blown game engine. I have a struct which contains const fields, and it works fine with pure c. // Don't mind the type names, those are configured in somewhere else in the project typedef st

Problem with template and async

2020-08-27 Thread gabbhack
I don't understand why this example don't work. Is the body of the template should not simply be inlined at compile time?

Blog post about strict funcs

2020-08-27 Thread treeform
Finally func is going to be doing what I though it should be doing!

Blog post about strict funcs

2020-08-27 Thread Araq
I wrote a new blog post: Please enjoy and feel free to ask questions here.

io2 module in stew

2020-08-27 Thread euant
Not using `FILE` for file processing is perhaps my favourite bit. Also looks like there's some consideration of [#12327](https://github.com/nim-lang/Nim/issues/12327), which is great to see as I've ran into a few issues over the years that stem from it.

List with the modules of the Standard library which do not work with the JS backend

2020-08-27 Thread juancarlospaco
Usually the ones that work on NimScript may work on JavaScript, and theres a list on the NimScript documentation.

List with the modules of the Standard library which do not work with the JS backend

2020-08-27 Thread Yardanico
Just so you know - osproc wouldn't make sense to support with the JS backend anyway, since Nim JS backend is made for the front-end stuff, not node.js backend. Node.js support is there only for the test suite

Handling in-place functions efficiently

2020-08-27 Thread exelotl
Unfortunately there are many functions like this in the standard library which only return copies. The introduction of [dup](https://nim-lang.org/blog/2020/04/03/version-120-released.html#dup) in Nim 1.2.0 is helping to fix all this, but it appears to be a long-term plan where (perhaps in Nim

Handling in-place functions efficiently

2020-08-27 Thread ElAfalw
Let's say I have a string and want to make it uppercase. I would do: str = str.toUpperAscii() Run Is there any _in-place_ way to do the same? (like Ruby's `str.upcase!`) I'm not particularly interested in the uppercase function. I'm looking for some more... universal

Generic vs static parameter

2020-08-27 Thread mratsim
> Are those the ones giving me a headache when I try to create new types from > existing types with macros? Trying to understand the rules by trial-and-error > turned out to be quite a time sink. Maybe we need a list of things not to try > without understanding the compiler source. Likely since

List with the modules of the Standard library which do not work with the JS backend

2020-08-27 Thread ElegantBeef
No, many modules work like `bitops`, any module that does anything in that list will most likely not be supported.

Generic vs static parameter

2020-08-27 Thread gemath
> Apparently the utter lack of generics, static, typedesc, concepts didn't > prevent Go success ;). Yes, because people know what they get. Having a bunch of features with overlapping problem domains implemented inconsistently is not a better deal for everyone. > Also you forgot `distinct` It