Re: Compiling?

2019-09-24 Thread dponyatov
Terminology mishmash adds unneeded confusion.

  * Translator means high-level to high-level
  * Compilation means high-level to low-level or binary



For myself, I call current Nim implementation is translator only, it can 
distinct other possible Nim implementation via LLVM (low-level SSA) as the 
compiler. 


Re: Possible minor bug in unused import checker [1.0]

2019-09-24 Thread Araq
Thank you. Please report this issue on github.


Re: Compiling?

2019-09-24 Thread Araq
> Nim is only a transpiler for JavaScript.

Gah... trigger word! :D


Idle thread garbage collection

2019-09-24 Thread dponyatov
Is Nim garbage collector can be isolated to separate thread to be run in an 
idle thread in hard-realtime systems? I'm still looking on Nim usage on 
Cortex-M and MSP430x microcontrollers, and integrate it with FreeRTOS. 


Re: Idle thread garbage collection

2019-09-24 Thread Araq
No, a heap is tied to a thread and cannot be moved elsewhere for a background 
collection. Not unlike Erlang does it. But it does respect the deadlines if you 
operate in its "realtime mode".

Note this is for soft-realtime applications, hard-realtime are different beasts 
and you're better off with avoiding `ref`, `closure`, pool allocations and 
Nim's `--newruntime` switch.


Re: Nim for Beginners Video Series

2019-09-24 Thread treeform
Looks good. I hope you continue.


Re: Nim playground

2019-09-24 Thread vishr
AdHoc user is created and destroyed after processing.


Re: 1.0.0 is here

2019-09-24 Thread simpleelegant
Everyday I opened Nim homepage to check whether 1.0 is arrived. 


Re: [RFC] Why use Nim?

2019-09-24 Thread Libman
I think the question of "Why use Nim?" is incomplete without context. There 
should be several specific variants of this question, each with a somewhat 
different set of arguments:

  * Why use Nim to teach 
[CS101](https://www.i-programmer.info/news/150-training-a-education/7511-python-becomes-most-popular-cs-teaching-language.html)?
  * Why use Nim for mobile apps?
  * Why use Nim for desktop apps?
  * Why use Nim for desktop games?
  * Why use Nim for Web front-end?
  * Why use Nim for [Web 
back-end](https://www.techempower.com/benchmarks/#section=data-r17=cl=json)?
  * Why use Nim for a new OS kernel?
  * Why use Nim for command-line tools?



Etc. And sometimes the answer will be "No, Nim isn't the best option". In some 
comparisons C, Python, or ye olde shell script still wins... 

Since I focus almost entirely on **command-line tools** , I can provide the 
following reasons for using Nim to write, let's say, [a new 
ls](https://github.com/ogham/exa), 
[rsync](https://github.com/kristapsdz/openrsync), or nmap:

  * Much more productive and safer than C/C++, with almost no performance loss.
  * No run-time, and much smaller binary sizes than Rust, D, Go, Haskell, etc.
  * Nim is more portable than some languages to obscure Unix variants (ex. all 
BSDs, Solaris, AIX, MINIX), HaikuOS, etc. Many competing languages 
([Dlang](https://forum.dlang.org/thread/hpauduyizitshugjj...@forum.dlang.org?page=3),
 Swift, .NET Core, Julia, Red/System) don't even support OpenBSD! Many also 
don't support some CPU architectures (ex. RISC-V), while Nim is easy to port 
because it can leverage just about any C compiler.
  * Having the option of using a different backend (gcc, msvc, [IBM z/OS 
XL](https://en.wikipedia.org/wiki/IBM_XL_C/C%2B%2B_Compilers), 
[icc](https://en.wikipedia.org/wiki/Intel_C%2B%2B_Compiler), 
[aocc](https://en.wikipedia.org/wiki/AMD_Optimizing_C/C%2B%2B_Compiler), 
[pgi](https://www.pgroup.com/index.htm), etc) means better performance than 
LLVM (Rust, DMD, Crystal, Swift, Zig, Pony, Kotlin Native, 
[etc](https://llvm.org/ProjectsWithLLVM/)) on some specialized platforms.
  * Nim is still a [permissive licensing champion](https://archive.fo/YShGX), 
with no restrictively-licensed dependencies and all tooling being MIT-licensed 
(or [equivalent](http://copyfree.org)). This means Nim can be used in all 
possible contexts.
  * See the "base must compile base" reasoning for [OpenBSD rejecting base 
components written in "safe" 
languages](https://duckduckgo.com/?q="Integrating+safe+languages+into+OpenBSD%3F;)
 like Rust. If any language can supplant C there, the compiler itself would 
have to have very minimal compile time. Here Nim is second [only to 
Vlang](https://archive.fo/k5XfE#selection-473.0-478.0) (which isn't a serious 
competitor yet), and orders of magnitude better than anything based on LLVM.




Re: Modify AST at compile time?

2019-09-24 Thread LeuGim
But @LeFF asks for this - 
[https://forum.nim-lang.org/t/4068](https://forum.nim-lang.org/t/4068) (module 
level macro), and even the same for whole the program.


Re: Modify AST at compile time?

2019-09-24 Thread mratsim
Create a macro say inject_profile


inject_profile:
  proc foo() =
discard
  
  proc bar() =
discard
  
  proc baz() =
discard


Run

In the inject_profile macro you iterate on all items contained in the 
nnkStmtList, if you find a RoutineNode (proc, template, iterator, macro), you 
replace the nnkStmtList body with prologue+body+epilogue.

However I recommend you go the template way instead, it will give you much more 
granularity for example this is what I use for [profiling my multithreading 
runtime](https://github.com/mratsim/weave/blob/2bb0284eec8882412886fb15c948b2826b81/e04_channel_based_work_stealing/profile.nim#L52-L55):

> 
> template profile*(name, body: untyped): untyped {.dirty.} =
>   profile_start(name)
>   body
>   profile_stop(name)
> 
> 
> Run

And 
[usage](https://github.com/mratsim/weave/blob/330a5113e62f332441397208b1084008a576f83f/e04_channel_based_work_stealing/runtime.nim#L920-L969):
 


proc schedule() =
  ## Executed by worker threads
  
  while true: # Scheduling loop
# 1. Private task queue
while (let task = pop(); not task.isNil):
  assert not task.fn.isNil, "Thread: " & $ID & " received a null task 
function."
  profile(run_task):
run_task(task)
  profile(enq_deq_task):
deque_list_tl_task_cache(deque, task)

# 2. Work-stealing request
try_send_steal_request(idle = true)
assert requested != 0

var task: Task
profile(idle):
  while not recv_task(task):
assert deque.deque_list_tl_empty()
assert requested != 0
decline_all_steal_requests()

assert not task.fn.isNil, "Thread: " & $ID & " received a null task 
function."

let loot = task.batch
when defined(StealLastVictim):
  if task.victim != -1:
last_victim = task.victim
assert last_victim != ID
if loot > 1:
  profile(enq_deq_task):
task = deque_list_tl_pop(deque_list_tl_prepend(deque, task, loot))
have_tasks()

when defined(VictimCheck):
  if loot == 1 and splittable(task):
have_tasks()
when StealStrategy == StealKind.adaptative:
  inc num_steals_exec_recently

share_work()

profile(run_task):
  run_task(task)
profile(enq_deq_task):
  deque_list_tl_task_cache(deque, task)

if tasking_done():
  return


Run


Possible minor bug in unused import checker [1.0]

2019-09-24 Thread Wazubaba
Hi, signed up to post this. Congrats on achieving 1.0! My two current major 
projects already built just fine and in fact thanks to the unused imports 
message I was able to cull a bunch. I did however find a small problem. In one 
of them I have some modules which I export functionality from. The issue I 
found is that when one exports an imported module with a different name, i.e. 


import X as Y
export Y


Run

The compiler still warns about _X_ being an unused import, even if this is used 
in a module which imports this one.

Here's the minimal sample I confirmed this with: 
[https://anonfile.com/b3ueEe6an1/minimal_sample_zip](https://anonfile.com/b3ueEe6an1/minimal_sample_zip)


Re: WinCon vs 1.0.0

2019-09-24 Thread LeuGim
For me, no cyrillic characters get printed, just get skipped. Tested with many 
combinations of `-d:nimDontSetUtf8CodePage` and without, utf-8, windows-1251 
and DOS 866 (terminal's encoding) at Nim side and at terminal's side.


Re: Newbie Karax Question

2019-09-24 Thread dom96
> Are all DOM updates tied to events such that the datetime value wont update 
> on its own?

Yep, you need to ask Karax to refresh in your dateTimeUpdate. Afaik you can 
just call `redraw` to do that.


Nim for Beginners Video Series

2019-09-24 Thread Kiloneie
Hello, i have made an introductory video to Nim on YouTube and i will be making 
more in the coming days. This will be a video series meant to teach people 
programming in Nim to people who have never programmed before, or are new to 
Nim.

Link: [https://youtu.be/5tVIsDYPClA](https://youtu.be/5tVIsDYPClA)

Any and all criticism is welcome, i would like to know what i did wrong and how 
to improve.


Re: 1.0.0 is here

2019-09-24 Thread Sixte
Finally!! This is really good news. Congrats to Araq and anyone of the devel 
team. 


Re: WinCon vs 1.0.0

2019-09-24 Thread LeFF
I was wondering if using the WCHARs instead of CHARs may fix the issue? On 
Windows it always better to go Unicode way, instead of ANSI way, as the kernel 
itself in Unicode based. For example you could directly use _putws to output 
unicode strings.


Re: Modify AST at compile time?

2019-09-24 Thread LeFF
I don't quite get it, there is an attribute macro for example, it can transform 
the AST for functions that the attribute is assigned to. Is there a way to 
assign the attribute to the whole module? And to all modules that is being 
compiled with my project, including the Nim's stdlib?


Re: 1.0.0 is here

2019-09-24 Thread aguspiza2
It happened!!! Congrats!!! Long life to this wonderful language.


Re: Compiling?

2019-09-24 Thread treeform
You can get the c files in the cache folder ~/.cache/nim/_d. You 
can also call nim c -c to compile only C and stop. Useful for compiling to 
other OSs or mobile devices like Android or iOS>


Re: Compiling?

2019-09-24 Thread miran
> Is there a way to get the .c file before the compilation to binary?

`~/.cache/nim`


Re: Compiling?

2019-09-24 Thread juancarlospaco
`--nimcache:.` will put the .c on the current folder.


Re: Modify AST at compile time?

2019-09-24 Thread juancarlospaco
Yes, you can modify AST with Nim.

The compiler is also a package on Nimble, you can import stuff from it. The 
rest sounds kind of complex, but still. 


Newbie Karax Question

2019-09-24 Thread Phillips126
I'm learning Karax (for fun) and seem to be having an issue with text updating 
- most likely I am doing something wrong.

My main `app.nim` is simply: 


include karax/prelude

import components/header

proc main() =
  proc render(): VNode =
buildHtml:
  tdiv:
renderHeader()
  
  setRenderer render

when isMainModule:
  main()


Run

The `header.nim` file is: 


import sugar, times
include karax/prelude
from dom import setTimeout

const dateTimeFormat = ", , d,  - h:mm:ss tt"
var datetime: kstring = ""

proc dateTimeUpdate() =
  datetime = format(now(), dateTimeFormat)
  echo "update time - " & datetime  # <-- This is showing up correctly in 
the browsers console
  discard dom.window.setTimeout(dateTimeUpdate, 1000)

dateTimeUpdate()

proc renderHeader*(): VNode =
  buildHtml:
tdiv:
  h1(text datetime)  # <-- This isn't updating on its own
  button(text="Hello", onclick = () => (echo datetime)):   # <-- 
Clicking this unrelated button causes the DOM to update
text "Hello Button"


Run

The `dateTimeUpdate()` proc does seem to be updating the datetime value as per 
the web console: 


update time - Tuesday, September, 24, 2019 - 3:00:10 PM
update time - Tuesday, September, 24, 2019 - 3:00:11 PM
update time - Tuesday, September, 24, 2019 - 3:00:12 PM
update time - Tuesday, September, 24, 2019 - 3:00:13 PM
update time - Tuesday, September, 24, 2019 - 3:00:14 PM
...


Run

I'm expecting the `h1` element to update every second with a new formatted 
datetime, however, it doesn't seem to update on it's own. When I click the 
button, it does update the DOM. Are all DOM updates tied to events such that 
the datetime value wont update on its own?


Re: Compiling?

2019-09-24 Thread powerss456
Thank you a lot Araq, moigagoo, treeform and juancarlospaco.

Is there a way to get the .c file before the compilation to binary?


Re: WinCon vs 1.0.0

2019-09-24 Thread treeform
Not a nim issue but a windows terminal issue. Call 


chcp 65001


Run

To set output to unicode.

Borders and Unicode works great after that.


Re: Compiling?

2019-09-24 Thread juancarlospaco
Nim is a Compiler. Nim is only a transpiler for JavaScript.

All code end up being _binary code_ , AKA machine code, AKA _".exe"_, even 
highest level ones, try `node --print_code -e 1+1` and you will see.


Re: Compiling?

2019-09-24 Thread treeform
Yeah, you can think of it as translating the code “twice”, but that is not the 
whole picture.

You can break out the compilation process into any number of steps! Depends 
what you count as a “translation” step.

I think of nim being 1 step:

nim -> exe comes out.

But you can think of it as 2 steps:

nim -> C -> exe comes out.

But really C has its own steps, so maybe 4 steps:

nim -> C -> Assembler -> Linker -> exe comes out.

But really there are a ton of steps in the middle too, maybe 18 steps is more 
accurate:

Nim lexical Nim syntax Nim semantic Nim generics folding Nim macro expansion 
Nim code generator C preprocessor C lexical C syntax C intermediate code 
generator C code optimizer C target code generator Assembler preprocessor 
Assembler Lexical Assembler Syntax Assembler code generator Linker Exe comes 
out.

Is one step better than any other step? Does the number of steps matter? If you 
stuff compiles fast - and it does compile fast with nim - it does not matter at 
all.

How many “translation” steps does nim have? Depends how you count.


Re: 1.0.0 is here

2019-09-24 Thread siloamx
Awesome! Now I can use Nim in production.


Re: Compiling?

2019-09-24 Thread moigagoo
Nim only does the Nim code to C | C++ | JS code transformation. C | C++ to 
binary is done by a C | C++ compiler.


Modify AST at compile time?

2019-09-24 Thread LeFF
Hello! Sorry if my question is too obvious, I'm still new to Nim. I know Nim is 
great at metaprogramming stuff. Is it possible to get and transform the AST of 
all compiled modules at compile time? Basically I want to inject some custom 
code to the begining and to the end of all functions (including Nim's standard 
library) so I could integrate Nim projects with our custom profiling system, 
written in C. Then I will need to search and transform some AST nodes for the 
sake of code protection, but I need to start somewhere. Is it possible with 
Nim's metaprogramming tools?


Re: 1.0.0 is here

2019-09-24 Thread LeFF
That's great news! Thanks to all the people involved!


Re: Tried to learn NIM some feedback

2019-09-24 Thread ffred60
> But lots of packages has the Docs built-in as documentation comments, 
> including runnableExamples.

so you think that a simple - even small - readme file telling what the package 
is or can do is not necessary ? why would I take time to look at the code if 
there's not even a few words telling me what I could find there sorry but 
more generally in that case there's no more doc inside the code.


Re: Compiling?

2019-09-24 Thread Araq
There is no meaningful distinction between a "translator" and a "compiler".

Is GCC a real compiler or only a translator to GNU assembler? Is Rust a real 
compiler or only a translator to LLVM IR? 


Re: Compiling?

2019-09-24 Thread powerss456
Hi,

So, the Nim compiler translate my code twice?

Something like that:

Nim -> .cpp -> .exe


Compiling?

2019-09-24 Thread powerss456
So, is Nim compiler only a translate to others languages? Like:

Nim -> C -> binary code Nim -> C++ -> binary code Nim -> JS


Re: [RFC] Why use Nim?

2019-09-24 Thread bpr
Your comparison with D neglects a few points in D's favor (and surely some in 
Nim's favor too...) that I think deserve mention, namely that D supports the 
equivalent of template template parameters and that D templates are templated 
over scoped code blocks, and that the class/function template divide of C++ is 
emulated in D with a shorthand (eponymous templates) but that the full code 
block introduces a new scope, which can be very useful. I tried to explain that 
[here](https://forum.nim-lang.org/t/5006) but I failed badly.

That said, I still prefer Nim.


Re: 1.0.0 is here

2019-09-24 Thread bpr
Congratulations to the entire Nim team. It's about time! Now, when is Nim 2.0 
coming out? :-P


Re: [RFC] Why use Nim?

2019-09-24 Thread rayman22201
Got picked up on ZDnet as well: 
[https://www.zdnet.com/article/python-inspired-nim-version-1-0-of-the-programming-language-launches](https://www.zdnet.com/article/python-inspired-nim-version-1-0-of-the-programming-language-launches)/


Re: [RFC] Why use Nim?

2019-09-24 Thread timothee
Well, the article was published this morning, here it is: 
[https://www.theregister.co.uk/2019/09/24/nim_version_10](https://www.theregister.co.uk/2019/09/24/nim_version_10)/


Re: [RFC] Why use Nim?

2019-09-24 Thread SolitudeSF
comments are even better then usual reddit/hn crowd.


Re: WinCon vs 1.0.0

2019-09-24 Thread Aiesha_Nazarothi
Nah, fourth time is special. Fourth time I will show this beauty to you, not 
tell: 
[https://sun9-37.userapi.com/c858420/v858420146/88b28/u_LHAtZ1LD0.jpg](https://sun9-37.userapi.com/c858420/v858420146/88b28/u_LHAtZ1LD0.jpg)


Re: WinCon vs 1.0.0

2019-09-24 Thread miran
> So, what should we do now ?

You should definitely tell us about it for the fourth time in a single day.


Re: WinCon vs 1.0.0

2019-09-24 Thread Aiesha_Nazarothi
It's stereotype, like all Linux users having red insomniac eye and ~nix having 
no gaems. In reality old-school terminal interface is quite perfect for utils 
like mass testers.

And, pardon me, _what_ Windows users of Nim supposed to use if not terminal ?


Re: WinCon vs 1.0.0

2019-09-24 Thread juancarlospaco
I am a Linux person, but...

all times Ive seen a Windows _user_ they wont use Terminal at all, all times 
Ive seen a Windows _developer_ they wont use the native built-in Terminal at 
all.

路‍♀️


Re: Tried to learn NIM some feedback

2019-09-24 Thread juancarlospaco
But lots of packages has the Docs built-in as documentation comments, including 
`runnableExamples`. 


WinCon vs 1.0.0

2019-09-24 Thread Aiesha_Nazarothi
So, it's release time, I heard. So, Nim is production quality now. And yet, 
situation with Windows terminal now is worse than ever. Not only cyrillics 
(even system error messages !), but even extended characters (like borders) is 
mangled when printed to console now.


Re: [RFC] Why use Nim?

2019-09-24 Thread dponyatov
Cross-compiling should be noted, especially for low-end platforms like 
Cortex-M. It is far from ready to use but is language will evolve, it can be a 
killer feature comparing to Rust and Go. (Rust is there too).


Re: 1.0.0 is here

2019-09-24 Thread jyapayne
Congrats guys! Nice work :)


Re: 1.0.0 is here

2019-09-24 Thread mikebelanger
I'd just like to thank all the developers who contributed to this. What stands 
out for me is the new importjs pragma. Much more intuitive than the importcpp 
thing. Great work!


Re: Great tutorials needed

2019-09-24 Thread miran
> is the "miran" in "narimiran" the same as @miran ? if so, nice work, thanks !

It is, thanks :)


Re: Great tutorials needed

2019-09-24 Thread ffred60
the first one on the learn page, "Nim Basics", is the better one to start.

[https://narimiran.github.io/nim-basics](https://narimiran.github.io/nim-basics)/

_is the "miran" in "narimiran" the same as @miran ? if so, nice work, thanks !_


Re: Error by duplicated file names (redefinition of 'types'; previous declaration here...)

2019-09-24 Thread LeuGim
It's tested with v.1.0.0.


Re: 1.0.0 is here

2019-09-24 Thread allochi
Congratulations! This is an great news!!! Well done!


Re: 1.0.0 is here

2019-09-24 Thread Araq
> A great day for Nim. (day, when console support got broken even more than 
> ever)

Worked for us and was tested on three different terminals... ;-)


Re: [RFC] Why use Nim?

2019-09-24 Thread Hideki

Nim macros in particular allow manipulating the syntax tree to write custom 
DSL's


Run

How about adding a sinatra-like web framework (Jester) as an example of DSL?


Re: Tried to learn NIM some feedback

2019-09-24 Thread mratsim
Fair. The main point is that if you are unhappy with Nim's threading, you can 
write your own.


Re: 1.0.0 is here

2019-09-24 Thread zolern
Great day for all of us that love Nim! And the big good news for our Nim are 
yet to come!

Cheers to all Nimsters!


Re: [RFC] Why use Nim?

2019-09-24 Thread mratsim
> C++ with its classes and template is really hard. Can Nim use C++ libs like 
> Boost, CGAL, Qt out of the box?

I'm pretty sure it can.

We have wrapped a header-only C++ template-only bigint library: 
[https://github.com/status-im/nim-ttmath](https://github.com/status-im/nim-ttmath).

More benefits of the macro system:

  * no need to resort to Python, Ruby or JS codegen, or 2 step codegen to write 
an Assembler, VM Emulator, all can be done in Nim.
* Example of C++ 2-step codegen for a popular assembler with text 
interpolation: 
[XByak](https://github.com/herumi/xbyak/blob/master/gen/gen_code.cpp) used by 
many projects including Intel Deep Learning backend.
* Another example with a JS opcode table codegen, that is then pasted into 
C++ by 
[asmjit](https://github.com/asmjit/asmjit/blob/238243530a35f5ad6205695ff0267b8bd639543a/src/asmjit/x86/x86instdb.cpp#L12-L16)
 used notably by Facebook's PyTorch.
* Nim proof-of-concept [Assembler opcode 
codegen](https://github.com/numforge/laser/blob/2f619fdbb2496aa7a5e5538035a8d42d88db8c10/laser/photon_jit/x86_64/x86_64_ops.nim).
* Nim proof-of-concept [emulator codegen for 
6502](https://github.com/mratsim/glyph/blob/8b278c5e76c3f1053a196173a93686afda0596cc/glyph/snes/opcodes.nim)
  * You can reimplement Numpy-like indexing which is one of the main draws of 
Numpy, Julia and Matlab.
  * You can even implement your [own compiler in 
macros](https://github.com/numforge/laser/tree/2f619fdbb2496aa7a5e5538035a8d42d88db8c10/laser/lux_compiler)



i.e. I think Nim is the best language to provide custom focused DSL.

Beyond the macro system, I'm not aware of any other languages with the complete 
package of:

  * distinct types (i.e. avoid mixing Meters and Miles)
  * range types
  * type-level integer/boolean/enum
  * generics



which allows enforcing several constraints at compile-time.

In terms of breadth, Nim allows getting as close-to-metal as C when needed but 
as high-level as Python in case where tight control over OS resources (memory, 
file descriptor, sockets, ...) is not needed. The fact that the GC is tunable 
(we can swap implementation between deferred reference counting, 
mark-and-sweep, boehm) and also decided per type (only ref objects are GC-ed, 
plain object and ptr object are not) makes Nim very flexible.


Great tutorials needed

2019-09-24 Thread FartCanister
Is there any getting started tutorials for Nim? I mean nice and clear step by 
step tutorials with great explanation, infographics, maybe video playlist on 
Youtube channel e.t.c. Also with real-world examples.


Re: Great tutorials needed

2019-09-24 Thread miran
We have these: 
[https://nim-lang.org/learn.html](https://nim-lang.org/learn.html)

Whether those are "nice and clear step by step tutorials with great 
explanation" it is up to the reader to decide.


Re: 1.0.0 is here

2019-09-24 Thread Aiesha_Nazarothi
A great day for nim. (day, when console support got broken even more than ever)


Re: [RFC] Why use Nim?

2019-09-24 Thread timothee
thanks; I've updated the wording in the C++ interop paragraph


Re: 1.0.0 is here

2019-09-24 Thread coffeepot
A great day for Nim! Congratulations to Araq and the entire Nim team, fantastic 
work on a huge milestone!


Re: [RFC] Why use Nim?

2019-09-24 Thread Stefan_Salewski
> Very few other languages support direct C++ interop.

I think we should not advertize C++ interop. too loud.

C++ with its classes and template is really hard. Can Nim use C++ libs like 
Boost, CGAL, Qt out of the box? I dont think so, and I think onl C++ itself can 
use these libs unrestricted. (Some years ago I had to call CGAL and Boost 
functions from Ruby -- well it is possible using plain C interfaces and fixed 
template parameters, but it is not easy and very restricted.)


[RFC] Why use Nim?

2019-09-24 Thread timothee
I was asked to comment on the following for an article: > Nim has just reached 
1.0 and I was wondering whether you might be willing to comment on why Nim is 
useful and where it fits into the continuum of programming languages?

Here's my tentative response; feedback is welcome:

Nim gives you the speed and portability of C, the ease of use of python, fast 
compilation (30 seconds to recompile nim itself). It supports a wide range of 
platforms (including android and iOS) and targets C/C++/javascript which means 
you can write your entire stack (frontend/backend/mobile) using the same 
language and standard library.

C/C++/js interop makes it easy to gradually incorporate nim in an existing 
codebase and take advantage of existing foreign libraries. These bindings can 
further be automatically generated (see c2nim and nimterop). Very few other 
languages support direct C++ interop.

Like D, Nim is relatively unopiniated and supports multiple programming 
paradigms (imperative, generic, object oriented, functional). However what 
truly sets it apart from all other languages is its unique metaprogramming 
features. Nim macros in particular allow manipulating the syntax tree to write 
custom DSL's, eliminate boilerplate, automate binding generation (eg nimterop), 
integrate with python (nimpy), automatically serialize/deserialize (eg 
protobuf-nim), generate React-like single page web apps (karax), and more 
generally allow libraries to extend the language without bloating the compiler. 
And because all of this can be done at compile time, you also avoid the need 
for makefiles or complex build scripts.

While the language is by no means small (like C or go), the learning curve is 
much more gentle compared to languages like Rust or especially C++. The main 
drawbacks essentially derive from its small user base and lack of significant 
corporate backing: 3rd party libraries (distributed via nimble) are sometimes 
lacking, the rate of commits in the compiler/standard library is slow compared 
to more popular languages and limited by a small number of core / repeat 
contributors. Hopefully this will improve now that 1.0 was released. Some 
aspects of the language are more experimental / buggy / underspec'd so users 
should expect to encounter occasional issues especially when more advanced 
language features interact; this also means Nim may not be suitable in more 
conservative development environments.

See also 
[https://github.com/timotheecour/D_vs_nim](https://github.com/timotheecour/D_vs_nim)
 where I provide a more detailed comparison between Nim and D, a language with 
similar design goals (hopefully objective, as I've used D extensively before 
switching to Nim for most of my projects). 


Re: 1.0.0 is here

2019-09-24 Thread moigagoo
Updated the Docker images: 
[https://cloud.docker.com/u/nimlang/repository/docker/nimlang/nim/tags](https://cloud.docker.com/u/nimlang/repository/docker/nimlang/nim/tags)


Re: 1.0.0 is here

2019-09-24 Thread adrianv
SUCCESS! 


Re: 1.0.0 is here

2019-09-24 Thread Aiesha_Nazarothi
Error: undeclared identifier: 'mode' Hm...


Re: 1.0.0 is here

2019-09-24 Thread aviator
Very cool, congrats to the Nim team!


Re: 1.0.0 is here

2019-09-24 Thread ffred60
great news, thanks.. !!


Re: Tried to learn NIM some feedback

2019-09-24 Thread ffred60
> A third-party threadpool like 
> [https://github.com/yglukhov/threadpools](https://github.com/yglukhov/threadpools)

do you really think that newcomers on Nim will be using a package with not even 
a simple readme file ? when I find something like that on Github, I don't even 
look at the code or search for anything more, I go away..!