Re: Exploring namespaces support in Nim

2017-01-24 Thread lltp
@andrea: in addition to what @mmierzwa said (which is the main reason for all of this), there are also the problems of convenience and generality. In short, I don't want to cast an array[int] to a seq[int] each time I want element-wise operation because such casts would occur at nearly each

Re: Amicable numbers in Nim and a few questions

2017-01-24 Thread petevine
No problem. Anyway it was Rust being slower but that's an ARM specific bug that should have been fixed a long time ago here: [http://llvm.org/viewvc/llvm-project?view=revision=259657](http://llvm.org/viewvc/llvm-project?view=revision=259657)

Re: Amicable numbers in Nim and a few questions

2017-01-24 Thread lltp
@petevine: oops... well, I read the post and the answers this morning and then I noticed that Nim's version was twice as slow. I got back to it this evening and completely forgot that this was absolutely not the question here but only something I was curious about. Sorry about that!

Re: Audio/Video File Read/Write Support In NIM

2017-01-24 Thread Libman
We have lots of people pitching ideas they can't seem to implement themselves. Common problem. Other people could implement those ideas, but time and energy are finite. Also a common problem. What we need is some sort of NimLancer broker system that would make it easy for people to hire a

Re: Amicable numbers in Nim and a few questions

2017-01-24 Thread petevine
@lltp What problem exactly? Is there a performance hit on 64-bit perhaps?

Re: How to open new console window and File, FileInfo, FileHandle

2017-01-24 Thread Araq
[http://nim-lang.org/docs/osproc.html#execProcess,string,openArray[string],StringTableRef,set[ProcessOption]](http://forum.nim-lang.org/postActivity.xml#http-nim-lang-org-docs-osproc-html-execprocess-string-openarray-string-stringtableref-set-processoption)

Re: Exploring namespaces support in Nim

2017-01-24 Thread Libman
Duuude! "Namespace pollution" is, like, a bummer for like them like twentieth century square types in neckties and polished shoes, whose boss like reads code in Notepad and stuff. We got some way new far out ideas here, bro, like major consciousness expanding nimXperience! Embrace the anarchy,

Re: How to open new console window and File, FileInfo, FileHandle

2017-01-24 Thread AironGregatti
If I understand what you need, to convert a "string" to "WideCString", you can do the following: # Convert a "string" to "WideCString". proc toWideCString(str: string): WideCString = var i : int = 0 ret : WideCString new(ret)

Re: How to open new console window and File, FileInfo, FileHandle

2017-01-24 Thread Libman
Here's an incomplete idea that may or may not be helpful... There might be some fancy Windows API tricks for interacting with other console windows, but then your code would be more difficult to port. I would first consider the simplest solution: startProcess start / cmd with [the needed

Re: Exploring namespaces support in Nim

2017-01-24 Thread mmierzwa
Andrea, whilst its true, it is on library creator side, whilst we may want to decide how it would look like in our code, when there are two libraries where their creators did not use distinct type.

Re: Exploring namespaces support in Nim

2017-01-24 Thread andrea
(by the way, I think that the right way to handle different products is to actually use the symbols that are in common use and allow to write let x = v ⊗ w maybe as an alias for let x = v.tensor(w) for the case when one does not want to copy paste the

Re: Audio/Video File Read/Write Support In NIM

2017-01-24 Thread dom96
> If you want Nim to become popular in audiovisual computing - Computer Vision > for self-driving cars or Video Processing for Film & Television for example - > I strongly suggest that the language comes with basic image/audio/video > read/write capabilities by default. Yes, we do. So why

Re: Exploring namespaces support in Nim

2017-01-24 Thread andrea
Just one quick comment. Quoting the OP > Well, then it is useless. I am from a domain (science) where similar concepts > are generally called a similar way and where clashes occur a lot because > something as simple as * has a gazillion meanings depending on the context > (and all of them

How to open new console window and File, FileInfo, FileHandle

2017-01-24 Thread mmierzwa
Hi I am trying to open new console window and be able to write to it. My attempts failed. How to do that? (currently using MinGW) During my attempts I tried to create process using startProcess I noticed that I can get then FileHandle for process. However I do not know how obtain File to

Re: Exploring namespaces support in Nim

2017-01-24 Thread Araq
Ok, but no ETAs. Also: We need to decide if return types are considered too. from json import type JsonNode let x = parseJson() Valid? Invalid? Why?

Re: type mismatch assigning function pointer? gcsafeness confusion?

2017-01-24 Thread bpr
> There is an automatic conversion from nimcall to closure but not in tuple > constructors (for better or worse). What are the precise conditions under which one should choose a tuple over an object? I'd use them for points in n-space for small n, and other tasks where I wrap up a very small

Re: Exploring namespaces support in Nim

2017-01-24 Thread lltp
So, I experimented quite a lot... **@Araq**: you were completely right: a from Foo import type Bar would actually be awesome! Can we have that?

Re: Audio/Video File Read/Write Support In NIM

2017-01-24 Thread videobuddha
@ jlp765 We video and image processing guys tend to be highly specialized in "pixel operations" and "image processing operations". i.e. once we can get at the actual video RGB pixels or audio sample data we know what to do with them But we suck at things like setting up video file I/O -

Re: Amicable numbers in Nim and a few questions

2017-01-24 Thread lltp
In this specific case, the "problem" seems to arise from the use of int instead of int32.

Re: Why takes this code 22ns with cstring and 52ns with string?

2017-01-24 Thread Jehan
**Stefan_Salewski:** _And I had not assumed that it makes 30 ns difference for a proc call._ The reason is that a copy of the string is being made. This requires a memory allocation and copying the string. 30ns are 60-90 clock cycles on a 2-3GHz machine and are pretty easy to hit.

Re: Amicable numbers in Nim and a few questions

2017-01-24 Thread Jehan
**petevine:** _It would be good for usability if the nim compiler offered automated profiled builds as well as pass the expanded CFLAGS via --passC automatically in release mode._ You can do this via a `.nims` config file, e.g.: import strutils, sequtils let cflags =

Re: type mismatch assigning function pointer? gcsafeness confusion?

2017-01-24 Thread Araq
They are not the same, the proc type is `.closure` the proc is `.nimcall`. There is an automatic conversion from nimcall to closure but not in tuple constructors (for better or worse).

Re: Amicable numbers in Nim and a few questions

2017-01-24 Thread Araq
But I don't like environment variables, they are global shared state affecting the build environment... No thanks, it's already hard enough to figure out which set of options is passed to anything.

Re: Amicable numbers in Nim and a few questions

2017-01-24 Thread petevine
C compilers don't expand shell variables so the short answer to my questions seems to be no and no, use --passC It would be good for usability if the nim compiler offered automated profiled builds as well as pass the expanded CFLAGS via --passC automatically in release mode.

Re: unable to build PDF documentation

2017-01-24 Thread strikr
using this point as the reference of query, a link on arch linux forum was discovered [https://bbs.archlinux.org/viewtopic.php?id=91655](https://bbs.archlinux.org/viewtopic.php?id=91655) SOLUTION the following steps were undertaken. * re-install texlive-fontsextra (sudo pacman

Re: unable to build PDF documentation

2017-01-24 Thread strikr
i took the following approach to troubleshooting the situation. Instead of running the command ./koch pdf or pdflatex doc/manual.tex i tried the following steps cd doc latex manual.tex dvips manual.dvi ps2pdf manual.pdf as

Re: Why takes this code 22ns with cstring and 52ns with string?

2017-01-24 Thread Stefan_Salewski
Indeed -- putting all that test code in a proc make differences disappear! I am aware of performance problems of code outside of procs, but I really had not thought that that was the problem in this case. And I had not assumed that it makes 30 ns difference for a proc call. I think in future I

Re: unable to build PDF documentation

2017-01-24 Thread strikr
There is no ~/.texlive directory !

Re: 2 question about DLL with Mingw

2017-01-24 Thread oyster
so how to export _double only in the DLL?

Re: Amicable numbers in Nim and a few questions

2017-01-24 Thread Varriount
The Nim compiler knows nothing about CFLAGS and related things, however the C compiler it uses should (if you're using GCC or Clang). You can also pass in arguments via `--passC` and `--passL` arguments. When benchmarking, it's good to remember some things: * Nim's `int` datatype is

Re: unable to build PDF documentation

2017-01-24 Thread axben
Two questions: 1) How would I build the docs on Windows (not LaTeX here w/o GNU) [Yes, I know, I could... => but this is more of a principal question... Is there perhaps another way to provide the source docs?] 2) Where would I download the readily compiled docs? [Yes, I know => "The Index",

Re: How to understand pragmas in Nim?

2017-01-24 Thread flyx
proc compile(code: string): {.compileTime.} NimNode = This is a syntax error because the proper syntax would be: proc compile(code: string): NimNode {.compileTime.} = Partly related: Ada is in a similar state. In the rationale of Ada 83, pragmas were described as

Re: How to understand pragmas in Nim?

2017-01-24 Thread Araq
> For instance, why introduce {.pure.} with enums to require full > qualification? If the compiler does not respect the pragma, there are syntax > errors in the code. Typing and naming should be enough to avoid enums names > clashes. Wouldn't work with Nim's disambiguation rules. Think of enum

Re: unable to build PDF documentation

2017-01-24 Thread strikr
a quick search with pacman shows that the font _is_ installed as it is part of the _texlive-core_ package. [strikr@victory nim]$ sudo pacman -Q -l texlive-core |grep ec-lmbxi10 texlive-core /usr/share/texmf-dist/fonts/tfm/public/lm/ec-lmbxi10.tfm

Re: unable to build PDF documentation

2017-01-24 Thread strikr
texlive-fontsextra is installed. [strikr@victory ~]$ sudo pacman -S -s texlive-fontsextra extra/texlive-fontsextra 2016.42286-1 (texlive-most) [installed] TeX Live - all sorts of extra fonts

Re: unable to build PDF documentation

2017-01-24 Thread strikr
yes, arch linux is the platform and 'nim' sources were 'git clone'd directly from github [https://github.com/nim-lang/nim](https://github.com/nim-lang/nim) _instead_ of arch aur nim-git. [strikr@victory ~]$ uname -a Linux victory 4.9.5-1-ARCH #1 SMP PREEMPT Fri Jan 20 12:11:50

Re: unable to build PDF documentation

2017-01-24 Thread strikr
running pdflatex doc/manual.tex shows a _missing_ font ... kpathsea: Running mktexpk --mfmode / --bdpi 600 --mag 1+120/600 --dpi 720 ec-lmbxi10 mktexpk: don't know how to create bitmap font for ec-lmbxi10. mktexpk: perhaps ec-lmbxi10 is missing from the map file.

How to understand pragmas in Nim?

2017-01-24 Thread spip
I'm discovering Nim and I'm in the learning phase reading the documentation. I'm impressed by the language that combines elegance and power, without sacrificing security. But I've strange feeling regarding the use of pragmas in Nim. This preamble is to justify my naive view of the language and

Re: Audio/Video File Read/Write Support In NIM

2017-01-24 Thread jlp765
**@videobuddha - what do you currently use (language/libraries/codecs/...)?** There are a few Nimble packages that wrap external libraries already: **audio** * nim-ao * nim-ogg * nim-vorbis * nim-portaudio * nim-sndfile * sndhdr * nshout * taglib * sdl2 (for gaming)