Re: Terminal based GINTRO(GTK) VTE

2020-05-12 Thread Stefan_Salewski
> But the best thing is to ask #Stefan_Salewski Not really as he does not use Windows. I added VTE to gintro some years ago because someone asked for it, but that guy never came back. I already asked Google about VTE for Windows, but with no clear result. When people really intent to use VTE o

Re: How to instantiate `ptr object`

2020-05-12 Thread Stefan_Salewski
That is also covered in my book in detail. Have you starting reading? [http://ssalewski.de/nimprogramming.html#_allocating_objects](http://ssalewski.de/nimprogramming.html#_allocating_objects) alloc(), create(), dealloc().

How to instantiate `ptr object`

2020-05-12 Thread dataPulverizer
One of the interesting things I remember about Nim is that you can have ptr object rather than ref object, since ptr object is not garbage collected. How do you create and destroy an ptr object? For example how do you correctly instantiate and destroy the two types below? type

Re: A good word for idiomatic nim?

2020-05-12 Thread moigagoo
Hochnimisch.

Re: Terminal based GINTRO(GTK) VTE

2020-05-12 Thread JPLRouge
[https://github.com/rprichard/winpty](https://github.com/rprichard/winpty) there it gives the possibility of doing the same thing as vte

Re: Is it possible for a macro to know the context it is used?

2020-05-12 Thread spip
Well, the DSL is more a language than a fixed structure. I gave a small sample code to feel it but you could have code like: dsl: algo1: evaluate: # Do something with algo1 result let x = getValue() algo2: # Using x to calculat

Standalone Libclang Nim Apps

2020-05-12 Thread deech
Hi all, I made a small [a small demo app](https://github.com/deech/libclang_nim_demo_app) that shows how to use Nim to make standalone applications that use [Libclang 10](https://clang.llvm.org/docs/Tooling.html) . In addition to a full set of [bindings](https://github.com/deech/libclang_bindi

Re: Terminal based GINTRO(GTK) VTE

2020-05-12 Thread Dankrad
I solved it for my problems by reading from stdout. This is one part of my workaround: [https://github.com/Dankr4d/BF2142Unlocker/blob/master/stdoutreader.nim](https://github.com/Dankr4d/BF2142Unlocker/blob/master/stdoutreader.nim)

Re: Terminal based GINTRO(GTK) VTE

2020-05-12 Thread JPLRouge
[https://stackoverflow.com/questions/6673022/windows-gui-console-output-linux-style](https://stackoverflow.com/questions/6673022/windows-gui-console-output-linux-style) I agree with you, you only need a program that, like Linux, has an open terminal-type GUI. for a while i made my terminal in C i

Re: Terminal based GINTRO(GTK) VTE

2020-05-12 Thread Dankrad
Maybe this was my fault: `Cygwin is a Linux-like environment for Windows. It consists of two parts: A DLL (cygwin1.dll) which acts as a Linux API emulation layer providing substantial Linux API functionality.` I'm not sure if i can link against cygwin with an application compiling with mingw.

Re: Terminal based GINTRO(GTK) VTE

2020-05-12 Thread JPLRouge
[https://download.gnome.org/sources/vte/0.60/](https://download.gnome.org/sources/vte/0.60/) I also sought to help you, maybe you can compile there is the free vte

Re: Terminal based GINTRO(GTK) VTE

2020-05-12 Thread Dankrad
The project you posted is written with gtk vte and written for linux. Also I've copied the vte.nim from my linux system to my windows system. But this fails with an access violation error. Then I tried using the cygwin vte package you've posted earlier and this is build for gtk2 not gtk3. And y

Re: How to parse html wild?

2020-05-12 Thread bung
[https://play.nim-lang.org/#ix=2lQ8](https://play.nim-lang.org/#ix=2lQ8) [https://play.nim-lang.org/#ix=2lQa](https://play.nim-lang.org/#ix=2lQa) in fusion htmlparser this would not be a problem

Re: Is it possible for a macro to know the context it is used?

2020-05-12 Thread dawkot
This is how I would do it import macros macro dsl(nodes) = result = newStmtList() for n in nodes: var value: NimNode if eqIdent(n[0], "algo1"): value = newLit"Foo" elif eqIdent(n[0], "algo2"): value = newLit(123) else: error "Unexp

Re: Terminal based GINTRO(GTK) VTE

2020-05-12 Thread JPLRouge
if you want to make your own terminal under windows with gtk [https://github.com/AS400JPLPC/VteTERM](https://github.com/AS400JPLPC/VteTERM) even if it is under linux you must not have too much problem in C / C ++ after you can directly call programs made with nim

Re: Terminal based GINTRO(GTK) VTE

2020-05-12 Thread Dankrad
The vte.nim file is not generated. I'm assuming you never tested it on windows? If I want to know how the vte.nim file looks like, i can boot linux. But your answer sadly do not help me.

Is it possible for a macro to know the context it is used?

2020-05-12 Thread spip
For instance, I have a small dsl like: dsl: algo1: evaluate: echo "Evaluation is " & $value algo2: evaluate: echo "Evaluation is " & $value Run The role of `evaluate` is to retrieve the result of calculation using `algo1`

Re: A good word for idiomatic nim?

2020-05-12 Thread cmc
In reference to the original name- I'd love to discuss whether code is "Royale" enough or not.

Re: A good word for idiomatic nim?

2020-05-12 Thread juancarlospaco
I read the 2 just Ok anyway. :P

Re: A good word for idiomatic nim?

2020-05-12 Thread refaqtor
"niminal" as the key aspect of Nim that I like is it minimal nature.

Re: A good word for idiomatic nim?

2020-05-12 Thread snej
"nimsy". As in "All nimsy were the borogoves..."

Re: A good word for idiomatic nim?

2020-05-12 Thread Araq
Boring: Simply "idiomatic". The context "for Nim" is usually implied. Fun: "nimish".

A good word for idiomatic nim?

2020-05-12 Thread JohnAD
This will be a fun/light post. The following is idiomatic to Nim: let myNumber = 3 + 9 Run whereas the following is not: let My_Number = `+`(3,9) Run Prior to my introduction to Python I really never cared much about being idiomatic; but i

Re: Terminal based GINTRO(GTK) VTE

2020-05-12 Thread JPLRouge
hello OUHAAA bravo This is what it expects in the vte file in /pkgs/gintro-0.7.3/gintro/vte.nim Run {.warning[UnusedImport]: off.} import xlib, glib, gdk, gdkpixbuf, cairo, gtk, gobject, pango, gio, gmodule, atk const Lib = "libvte-2.91.so.0" {.pra

Q: An object variant case with no field?

2020-05-12 Thread snej
I'm implementing a variant object type, where one of the enum cases has no fields associated with it, but get a syntax error: type AuthenticatorType = enum None, Basic, Session, Cookie Authenticator = object

Re: Q: An object variant case with no field?

2020-05-12 Thread doofenstein
it works this way: type AuthenticatorType = enum None, Basic, Session, Cookie Authenticator = object case type: AuthenticatorType: of None: discard of Basic: username, passwor

Re: Nimpy and Arraymancer

2020-05-12 Thread Clonk
The following code gives me a compile time error : import arraymancer import nimpy import nimpy/raw_buffers proc `+`[T](p: ptr T, val: int) : ptr T {.inline.}= cast[ptr T](cast[uint](p) + cast[uint](val * sizeof(T))) proc pyBufToTensor[T](ndArray: PyOb

Re: Nimpy and Arraymancer

2020-05-12 Thread mratsim
you can use `numpy.reshape(ndarray, shape)` and `arraymancer.reshape(tensor, shape)`. The module name can serve as namespacing prefix when calling functions. Also your object types PyObject vs Tensor should disambiguate what to call for the compiler so I would be surprised if there was conflict,

Re: Multithreading Pt 2.5: Nichecache

2020-05-12 Thread dawkot
It's just a funny way of using command invocation syntax, usually used without braces: if unlikely position < 0: Run

Nimpy and Arraymancer

2020-05-12 Thread Clonk
Hello, I've done some testing with Nimpy and Arraymancer and I've run into a bit of an issue when trying to use Numpy function (via Nimpy) and Arraymancer because several functions have the same name. For a example, I can't use a numpy.reshape on a PyObject because it conflicts with the reshap

Re: Terminal based GINTRO(GTK) VTE

2020-05-12 Thread Dankrad
When I use the vte package then there are cygwin dependencies I don't want to have (and also the header file is missing). So I've decided to use libvte2.91-devel package (with sources). Now I've added following pathes to `PATH` environment var (without luck): * C:\cygwin64\usr\include\vte-2.9

Re: Docker image for cross compiling

2020-05-12 Thread brentp
very useful. thank you!

Re: Unexpected type error (subranges)

2020-05-12 Thread HashBackupJim
I did a little research and found an interesting post on mixing signed / unsigned issues, so I guess it's a good idea Nim doesn't like that: [https://critical.eschertech.com/2010/04/07/danger-unsigned-types-used-here](https://critical.eschertech.com/2010/04/07/danger-unsigned-types-used-here) It

Re: Multithreading Pt 2.5: Nichecache

2020-05-12 Thread spip
Also in the documentation, I noticed _Garbage-collectable types (string, seq, ref) cannot be used in keys or values._ and I don't understand the reason for such warning. If these values are used in the cache, they are live and won't be garbage collected, aren't they?

Re: Detect englobing scope in macros

2020-05-12 Thread Araq
We're always improving the documentation but here is a good rule of thumb: **Whenever you need to analyse the AST, you need a macro.**

Re: HashSet performance

2020-05-12 Thread cblake
Cool. Glad you got it working. That multiply-rotate hash in my last post does yield a noticeable boost. I get Python-3.8.2 times of 1.255..1.337, Nim-1.3.3 with default hash times of 0.391..0.531, and Nim-1.3.3 with that multiply-rotate of 0.205..0.347. So, with a fast, good enough hash Nim is

Some week-of-year procs for use with the times library

2020-05-12 Thread cmc
I was in need of week-of-year procs but couldn't find any so I wrote them. Putting them here for now because they aren't librarified enough yet to be packaged- no unit tests or docs yet. [https://play.nim-lang.org/#ix=2lN4](https://play.nim-lang.org/#ix=2lN4) Implements algorithms adapted from:

Re: HashSet performance

2020-05-12 Thread xkqqkx
Using the latest Nim 1.3.3 indeed solves the issue. Thanks!

Re: Multithreading Pt 2.5: Nichecache

2020-05-12 Thread Yardanico
So does it parse as `if unlikely(position < 0)` ?

Re: Multithreading Pt 2.5: Nichecache

2020-05-12 Thread Hlaaftana
Couldn't help but notice at [https://github.com/olliNiinivaara/Nichecache/blob/915317b2349673b1ccf502d39cd3ac3ea4875eb3/src/nichecache.nim#L99](https://github.com/olliNiinivaara/Nichecache/blob/915317b2349673b1ccf502d39cd3ac3ea4875eb3/src/nichecache.nim#L99) if(unlikely) position < 0