As far as I understood, he wants to declare a "let" and initialize it later.
It seems all the major operating systems are written mainly in C.
Unfortunately the main dev doesn't want operator overloading.
I don't have internet connexion these days. I'm curious to see if the browsing
is better. Thank you for the info.
Hi, I just discovered Zeal browser and that made docs reading (like terrible
GNU docs) less painful.
[https://www.casimages.com/i/19032110495424237016167956.png.html](https://www.casimages.com/i/19032110495424237016167956.png.html)
A VS code extension can open the docs from editor.
Even the black letters on the white background is a bit aggressive.
The first letter sensitivity can be used in proc arguments too, to save time.
Such errors gave me headeaches.
If you want your program to spawn objects during runtime you'll need ref
objects.
I just read your answers carefully and I will tests these solutions, my project
is much more complex than the example.
Thank you all for taking the time to write such insightful answers.
Sorry for that basic topic but I want an object field to be able to handle two
differents types with a clean syntax on the user side. No problem if the code
behinds the scene is a hacky template or something, but the user should never
need to see that.
I written a simplified example.
Case typos are not a big issue. Compilers errors messages will points you in
the right line.
If you import C identifiers (or other languages) style insensitivity may
introduce hard to find bugs. In some cases the compiler can silently replace
a_thing by aThing . It's less common than typos,
I'm too "casual" to submit a relevant opinion, I just want to add a little "-"
to the yglukhov enumeration : Insensitivity can scares newcomers. Most
languages are fully sensitive and most people are used to include the style as
a part of the identifier and to use the style to reduce the need
I had headeaches trying to find why my first opengl triangle looks like that
[https://nsm09.casimages.com/img/2018/11/16//18111610551424237015998588.png](https://nsm09.casimages.com/img/2018/11/16//18111610551424237015998588.png)
After two days I accidentally discovered that in a certain file
Ok, thank you !
I tried to do a search but it's not helpful (the forum search should look in
the titles first)
type Example = ref object
a:seq[string]
var anExample:Example
proc function(ex:Example, txt:string) =
ex.a.add(txt) # " SIGSEGV: Illegal storage access.
Thanks for the answer. I found a workaround by creating this c file who does
the includes.
#ifndef C_INCLUDES
# define C_INCLUDES
# include "GL/glew.h"
# include "GLFW/glfw3.h" //glfw3 must be the last include
#endif
Run
I added this
Sorry for the boring topic. I'm writing a side project for fun using Glew and
Glfw. And I encounter an external compiler error.
A test file who reproduces the error.
const
GLFW_CONTEXT_VERSION_MAJOR = 0x00022002
GLFW_CONTEXT_VERSION_MINOR = 0x00022003
Thanks to all contributors !
If Nim compiles to C Nim is not faster to C but Nim may produce faster C code
than human programmers.
Congratulation !
To use C code in Nim I compile the C files with -c option (on GCC), then I use
{.link: "your_binary.o".} pragma in Nim files and simple {.importc.} for each
function or type. Maybe there is uses cases where importing headers is
necessary but I haven't encontered this case for the moment. (maybe
@Allin I didn't find basic2d and basic3d, in the docs the links are dead.
> Yeah, that's precisely why it's done and you should follow it. It's that
> simple.
>
> Why not make the compiler enforce it? Because there are genuine cases where
> it's just easier to not follow the convention (eg. wrappers). But the
> convention is there to motivate people >to follow it,
I solved this by adding the "stb_image.nimble" file in my project folder (I had
just the "stb_image" folder). I haven't the motivation to investigate what
happened exactly, but anyway, that works.
Hello I try to use the
[stb_image](https://github.com/define-private-public/stb_image-Nim) lib.
I made this minimal test for my question.
import stb_image/read as stbi
var width, height, nrChannels:int
var test = stbi.load("some_image.jpg", width, height, nrChannels,
I can understand aedt rationale. The dot is already used to access objects
members. aedt idea made things clearer for me. But maybe I misunderstood the
real semantic of these expressions. Anyway, thanks for the tip Araq.
I 'll try to concentrate the simple types only (not compound types), in their
own module and try to keep a very hierarchical project structure, I hope it
will be enough !
> In fact, we have a figured out quite a few details already of how a pre-pass
> in the compiler could work to provide this
That makes sense.
Thanks again cdome.
I have another question with C but I want to avoid polluting the homepage with
noobish topics. And strings are kind of sequence isn't it ?
I want to pass a sequence to a C function but the result is unexpected.
Two files for minimal example.
proc
Hi I imported a c function who take a char array as argument. I pass a Nim
string to it but the 3 first characters aren't expected, like this one "|" and
random special chars who can't be displayed by the forum.
Code example
import streams
#import the c function.
proc
I solved this by using "\--passL" instead of "\--passC "
I tried to import a C file, that includes GLFW, in "test.nim", like this but I
fail.
nim c --passC: '`pkg-config glfw3 --static --cflags --libs`' test.nim
before that the .o file is created succesfully, like this.
gcc -Wall -c test.c -I.
All GLFW
@Jipok I found a decent black theme,
[here](https://github.com/rgieseke/textadept-themes) but yours is nice too.
The forum is very usable but a small set of tags for topics would be useful,
like "ide", "compilation", "syntax" for example . Nim's users base can grows,
especially if a Nim 1.0 will be released.
My version is 9.6. ui.set_theme() is the good function for me (and not
set_theme()), so it seems "ui" is also a buffer. The concept of buffer remains
mysterious for me, but Textadept is usable now.
Thanks for the quick answer but I have another question. How do you know the
name of the "buffer" you want to set ? The manual is not very clear about this.
Hi, I tried Textadept today I don't know where is the community so I ask here
because this editor supports Nim. I read all the API and manual during hours
and I didn't found how to set the default font size. Any help is welcome.
If Nim main dev wants to implement a new feature, and this feature uses a token
(or a whole expression) already used by a skin. How will you prevent the
breaking of many existing code ? (Sorry if the english is not very good)
I'm interested in NimScript as a portable "make-like", but I have some
questions.
What's the purpose of the string in the `task` expression ? What's exactly the
purpose of `setCommand` since you can control the compiler and the O.S using
`exec` ? What is the problem encountered if we don't use
Hi, I never had time to really test this great language, in consequence I'm a
kind of eternal noob, so I apologize for the trivial problem.
I try to bind a minimal C function for learning purpose.
c_function.h
int addTwo(int x)
{
return x + 2;
}
Thank you for the clarification. Sorry I didn't see you removed the autoloaded
.gdns file.
That binding bloats Godot project much more than the C++ and D bindings, it's
sad.
Nake tells my GODOT_BIN path is "invalid".
GODOT_BIN path: /home/drit0/Programmes/Godot3.0/godot-master/bin
But it is not true, I'm pretty sure it is the exact path of Godot.
Hi Tiberium.
I installed godot-nim using "nimble install godot" command succesfully but with
this warning.
Warning: File 'apigen.nim' inside package 'godot' is outside of the
permitted namespace, should be inside a directory named 'godot' but is in a
directory named 'apigen'
I try to follow instructions from the project examples
[https://github.com/pragmagic/godot-nim/tree/master/examples/stub](https://github.com/pragmagic/godot-nim/tree/master/examples/stub)
but when I run
nake build
nakefile.nim(5, 8) Error: cannot open 'godotapigen'
Unfortunately this binding needs a forked version of the engine. You must
consider this binding as a W.I.P.
Anyway it's nice work and I hope this will be completed soon.
I wonder how the Nim particular OOP works with the Godot Engine and his huge
inheritance tree. Maybe it does not matter... But anyway, this engine is
gradually gaining popularity and it can help Nim language to be more spreaded.
What amazes me is that Nim is a bit faster than some recent languages who
compiles directly to machine language.
Thanks for the help Araq.
The Nim enum behaves differently so I think this code reproduces better the Cpp
code behaviour.
const
ITALY = 0
GERMANY = 1
PORTUGAL = 2
var capital: array = ["Rome", "Berlin", "Lisbon"]
echo capital[PORTUGAL]
Sorry for the noobish question. I want to understand how using the enums like
in C/C++
// Example program
#include
#include
using namespace std;
int main()
{
enum country {ITALY, GERMANY, PORTUGAL};
string capital[] = {"Rome", "Berlin",
51 matches
Mail list logo