Python has no
[substring](http://net-informations.com/python/basics/substring.htm) methods
like substring() or substr(). Instead, we use slice syntax to get parts of
existing strings. Python slicing is a computationally fast way to methodically
access parts of your data. The colons (:) in
It's not clear.
[https://nim-lang.org/docs/manual_experimental.html#aliasing-restrictions-in-parameter-passing](https://nim-lang.org/docs/manual_experimental.html#aliasing-restrictions-in-parameter-passing)
> An output parameter should never be aliased with a global or thread local
> variable
This coding is just very impressive. I just program on my Mac and compile but
there is an issue when I try to compile it. There is an unknown error shown on
my screen for my Mac called
This coding is just very impressive. I just program on my Mac and compile but
there is an issue when I try to compile it. There is an unknown error shown on
my screen for my Mac called
This coding is just very impressive. I just program on my Mac and compile but
there is an issue when I try to compile it. There is an unknown error shown on
my screen for my Mac called
Thanks! This is exactly what I was looking for.
I wish there was a way to mark the thread resolved.
@timothee
I sent you build instructions for libffi on gitter, but here they are just for
posterity:
> I followed the instructions here:
Hi, I had a bug in some of my nim code and it produced some unusual behaviour.
It seems that the nim compiler assigns the result of a function before the said
function has completed. I managed to reproduce it:
import tables
var values:Table[string,string]
values["item
Hey all - following up on FOSDEM, a couple of us Nim developers from Status are
[hanging around](https://twitter.com/m_ratsim/status/1224769743892230151) in
Brussels for the week. I figured it might be a good time to highlight some of
the code we've been developing over the past few months.
I did some of my own testing using plain old C (GCC) to get more insight.
* Windows 10 console really likes UTF-16 encoded text. It simply cannot get
UTF-8 input.
* Forcing a program to get UTF-8 input **[ _setmode(_fileno(stdin),
_O_U8TEXT) ]** combined with UTF-8 code page results in NUL
I use `let fileAST = parseStmt(slurp(file))` with file being a static string
path to the file.
See
I wrote a sample Hot code reloading with GLFW. I placed it on gist because I
think the source code is too long to put in this forum.
[https://gist.github.com/demotomohiro/64050496bb615c50fa608d7105509a53](https://gist.github.com/demotomohiro/64050496bb615c50fa608d7105509a53)
It seems there are
When I started out with nimterop, I was forced to leverage gorgeEx and create a
separate binary toast due to this exact limitation. Nimterop uses tree-sitter
which is a C/C++ parsing library for a variety of programming languages so it
wasn't possible to load it during compile time.
Initially,
I essentially had the same use case as @PMunch in the past.
When I thought about implementing reading Keras stored NNs in Arraymancer, one
of the problems was that
1. creating a NN in Arraymancer currently means using the DSL to design the
network layout. Since that DSL generates a whole
The proposed solution works even without the intermediate template. If the arg
type is typed then the content of the included file is passed to the macro and
not the include statement.
However, there's still a problem with it. If the included module contains
macros, they are expanded before
@timothee Thank you again for the detailed example. I see you're getting around
the struct issue by passing back a pointer. It gets kind of messy, but I
suppose I can deal with it :)
> if you'd like to help, please tell me how I can download / build libffi on
> windows... I'm not a windows
@Araq
> What are the use cases? What is it you need to do at compile-time that's
> otherwise impossible?
I would simply like to use the entire std lib at compile time. For example,
sometimes it's annoying to not be able to use the regex module (although
nitely's pure nim library can be used
Now I'm even more confused.
Tried this simple code:
import macros
macro foo(body: untyped): untyped =
echo treeRepr body
foo:
var x = 123
Run
This won't print anything to stdout. I could swear it should print the tree
representation of
Thanks for the tip! This won't compile unfortunately: Error: unhandled
exception: 'ident' is not accessible using discriminant 'kind' of type 'TNode'
[FieldError]
You don't install nimble files, you install packages. Nimble file is just meta
for a package. So downloading the file alone won't do.
When you've cloned the repo, you can run either nimble install` or `nimble
develop in the repo folder to install the package or install in development
mode
That's actually a rather nifty use of the include statement! I can see using
that for something like generating mocks and tests.
> One thing to keep in mind is that having FFI in the VM allows it to also work
> in the secret interpreter.
That's a great point, but we can have a separate binary/tool for that like
`nimrepl`.
Try this.
import macros
template tt() : untyped =
include anothermodule
macro t(a : typed) : untyped =
echo treeRepr a
t(tt())
Run
Agree with Araq here;
find a way to do it with (a possibly improved) staticExec - or alternatively,
it could be solved with a bidirectional communication channel through pipes (or
sockets or shared memory, though these aren't good ideas either) if Nim code
with access to compiler types etc.
I need to find a db block in a module and copy it entirely to a new file.
So, I basically need a way to pass a module's code to a macro where I'll
iterate over its nodes to find the necessary one.
So far, I haven't found a way do so. Naïve attempts like this one don't work,
since I'm getting
My biggest reason for wanting FFI at compile-time is to be able to use
libraries that are wrappers around C libraries. For example for my Arduino
stuff I wrote a macro that reads an image file and converts that to an array of
bytes that is directly inserted into your code (this is how sprites
One thing to keep in mind is that having FFI in the VM allows it to also work
in the secret interpreter. This ensures that one can try out more things
interactively, such as anything that needs `times` for instance.
Thanks for explaining!
` cd projectdir nimble develop `
Run
29 matches
Mail list logo