Re: Fortran bindings

2019-07-16 Thread zio_tom78
I never tried to bind Fortran libraries to Nim, but I often have to deal with Fortran codes in my job. If you are lucky enough to work with Fortran 2003 or 2008, you can use `iso_c_binding`:

Re: Fortran bindings

2019-07-16 Thread treeform
The only time I have seen Fortran code is when dealing with nasa orbital simulation stuff. I think Fortran is pretty rare and experience with it is rare too. If it can export c calling convention and be compiled into a dynamic link library then anything is possible?

Re: side effects through local() or parse() from times module

2019-07-16 Thread treeform
"moon rise and set time" oh I have another library for you: [https://github.com/treeform/orbits](https://github.com/treeform/orbits) You can see adapt JPL Horizon api to get the exact "moon rise and set time" times directly from Nasa. You right about chrono and miniz. Miniz is just there to

Re: Nim Equivalent of Python Range [with Step]

2019-07-16 Thread chr
I had this question myself just yesterday and didn't notice `countup` in a browse through the `system` page. Looks like the "Nim for python programmers" page linked didn't mention it, so I went ahead and added a section about it!

Re: Source Code Protection

2019-07-16 Thread Libman
Reverse engineering even a normal compiled binary is a lot of work, but it can be studied in memory. It's easy to obfuscate all identifier names and add computational noise (there are C/C++ products that do this), which will make reverse engineering harder but still doable. The only way to

Re: Nim VS The World (CoffeeScript/Boo/PureBasic/C#/ES2018/Python)

2019-07-16 Thread Araq
Well your list lacks: [https://www.lazarus-ide.org](https://www.lazarus-ide.org)/

Re: Nim VS The World (CoffeeScript/Boo/PureBasic/C#/ES2018/Python)

2019-07-16 Thread Aiesha_Nazarothi
> Cost of implementing such std GUI / drawing / clipboard is not smaller than > third-party one, isn't it? If there is a such third-party library supports > major platforms, nice license, open source, why is std one needed? **If** there is - sure. Right now it's probably QT wrappers, which was

Re: Nim VS The World (CoffeeScript/Boo/PureBasic/C#/ES2018/Python)

2019-07-16 Thread Aiesha_Nazarothi
If "nice" means this 4 functions: # SDL_clipboard.h proc setClipboardText*(text: cstring): cint {.importc: "SDL_SetClipboardText".} proc getClipboardText*(): cstring {.importc: "SDL_GetClipboardText".} proc hasClipboardText*(): Bool32 {.importc: "SDL_HasClipboardText".}

Fortran bindings

2019-07-16 Thread mantielero
Just out of curiosity. Is binding with Fortran not considered or not feasible or just too much effort?

Re: side effects through local() or parse() from times module

2019-07-16 Thread juancarlospaco
If you know how to improve it, then send the improvements. If its not perfect does not meant is useless. IMHO.

Re: side effects through local() or parse() from times module

2019-07-16 Thread GULPF
This happens because the proc fields of `times.Timezone` isn't marked with `noSideEffect`. The same thing happens if you try to do anything with streams inside a `func`, since streams also use proc fields without `noSideEffect`. This could be changed, but imo Nims effect system isn't worth

Re: side effects through local() or parse() from times module

2019-07-16 Thread dschaadt
Thanks for the quick responses. When I try to use chrono, it complains that miniz is missing, so it that truely pure nim? Could it work without miniz. Unfortunately, I cannot use an approximate solution without timezones since the code will be used to calculate the moon rise and set time for a

Re: Nim Equivalent of Python Range [with Step]

2019-07-16 Thread miran
> I think it would be good to have a more fleshed out "Nim for {programming > language} programmers". There are some of them on the github page > > I would happily contribute to something line that *

Re: Nim Equivalent of Python Range [with Step]

2019-07-16 Thread hugogranstrom
> So you haven't yet read our page with the most learning resources? ;) > [https://nim-lang.org/learn.html](https://nim-lang.org/learn.html) Apparently not 臘‍♀️ can't remember when I looked there last time tbh. Are some really neat resources there! > These are in our wiki and everybody can

Re: Nim Equivalent of Python Range [with Step]

2019-07-16 Thread hugogranstrom
I think it would be good to have a more fleshed out "Nim for {programming language} programmers". There are some of them on the github page but I haven't found any links to them except from Google. I would happily contribute to something line that

Re: Nim Equivalent of Python Range [with Step]

2019-07-16 Thread madra
Thanks. I just came back to red-facedly say I'd sussed it out. But you beat me to it. I shall award myself the "RTFM Badge of Shame" immediately [although, in my defence, I searched the docs for "range" and "step". Didn't think of "countup"]

Re: Wrap C library that needs CMake

2019-07-16 Thread hugogranstrom
Awesome to hear :-) I'm also new to this so we are in the same boat ;-) What we don't know, we can learn. And in our case, will learn  Let me know if you gets it yo work, or more importantly if it doesn't. You learn more from a failure than a success  I have just been pounding at some

Re: optional params before `untyped` body

2019-07-16 Thread timothee
with this PR [https://github.com/nim-lang/Nim/pull/11754](https://github.com/nim-lang/Nim/pull/11754) we can do it as follows: dispatch foo: for a in 0..<3: echo a echo 10 Run

Re: Wrap C library that needs CMake

2019-07-16 Thread mantielero
I'd love to collaborate. But I am still pretty useless. I am trying to use it on Linux.

Re: Nim VS The World (CoffeeScript/Boo/PureBasic/C#/ES2018/Python)

2019-07-16 Thread Araq
Just in case somebody doesn't know already: SDL2 has some nice, simple clipboard support.

Can Nim tell me about unused imports, lets, const and .high?

2019-07-16 Thread treeform
Is there a way for nim to tell me when: * I can remove an import (unused imports) * I can convert a proc to a func (for procs that don't have site effects) * I can convert a var to a let (for variables that are only assigned once) * I can convert a let or var to a const (for variables in

Re: side effects through local() or parse() from times module

2019-07-16 Thread Araq
To circumvent the effect system, you can use this (since 0.20.0): func test(unixTime: int64): bool = {.noSideEffect.}: let t1 = local(fromUnix(unixTime)) Run

Re: side effects through local() or parse() from times module

2019-07-16 Thread treeform
I think it leads to side effects because it uses clib's time functions. I have a pure nim implementation of times, calendars and timezones here: [https://github.com/treeform/chrono](https://github.com/treeform/chrono) import chrono proc test1(unixTime: int64): bool =

Re: Nim VS The World (CoffeeScript/Boo/PureBasic/C#/ES2018/Python)

2019-07-16 Thread Neil_H
I didn't want to introduce more complexity by using XML (which is a pile of crap and always was) or JSON (which will hopefully go the same way as XML because its just as bad) just to put some strings into an array. Simple things like that should be built into the language.

Re: Nim VS The World (CoffeeScript/Boo/PureBasic/C#/ES2018/Python)

2019-07-16 Thread demotomohiro
There are platform without GUI or clipboard. (e.g. embed system, Linux without Xorg) Making std GUI / drawing / clipboard library means that the language doesn't support such platforms? When I want to compile these language that has std GUI / drawing / clipboard library, I also have to build

Re: Nim Equivalent of Python Range [with Step]

2019-07-16 Thread miran
There is [countup](https://nim-lang.github.io/Nim/system.html#countup.i%2CT%2CT%2CPositive), which can be used as: var text = "Hello there How are you This is a string Blah Blah Blah" for i in countup(0, len(text)-3, 2): echo text[i],text[i+1],text[i+2] Run

side effects through local() or parse() from times module

2019-07-16 Thread dschaadt
Hi, I'd like to write a function that extracts the date from a DateTime object returns a new DateTime object with that date but time set to 00:00:00. The input will be in unixtime due to other requirements. When I use the following func test(unixTime: int64): bool = let t1 =

Re: Nim VS The World (CoffeeScript/Boo/PureBasic/C#/ES2018/Python)

2019-07-16 Thread Aiesha_Nazarothi
> Is having a "std" GUI / drawing / clipboard / etc lib really so important > when there are non-"std" candidates in nimble? Yes, quite a lot. **Std** GUI lib means that you can and will be able to make ui using same code for every compatible platform _and_ 90% extensions (like custom

Nim Equivalent of Python Range [with Step]

2019-07-16 Thread madra
Probably one to file under "Newbie Questions", but here goes... I'm trying to iterate over a string and get the characters in it 3 at a time. In Python, I can use the fact that range has a step attribute to do something like: text = "Hello there How are you This is a string Blah

Re: Nim VS The World (CoffeeScript/Boo/PureBasic/C#/ES2018/Python)

2019-07-16 Thread Aiesha_Nazarothi
Tbh, "Data" command was never meant for anything useful except backward compatibility - just like, say, "GoSub". You can always just use 'IncludeBinary' and std JSON/XML parsers.

Re: Source Code Protection

2019-07-16 Thread Neil_H
I reckon it depends on what you are trying to hide? The source code itself or some routine that's running at the same time as your binary? The only way to fully guarantee some source code protection is to obfuscate it before you compile.

Problem wrapping a shared library with Nimterop (Sundials-N_Vector)

2019-07-16 Thread hugogranstrom
I have started to wrap the Sundials project and my first goal was to wrap the N_Vector shared library, which I to some extent has succeeded with but in a rather hacky, and not so seamless, way. The structure of the files can be found in my github repo:

Source Code Protection

2019-07-16 Thread ohenepee
Is there anyway to harden the compiled binaries against code hackers?

Re: sizeof a ref object type

2019-07-16 Thread roel
I just did: [https://github.com/nim-lang/Nim/issues/11747](https://github.com/nim-lang/Nim/issues/11747) Sufficient?

Re: sizeof a ref object type

2019-07-16 Thread Araq
echo sizeof(MyRefObject[]) Run should just work, bug report please.