Press J to jump to the feed. Press question mark to learn the rest of the keyboard shortcuts
Found the internet!

Nim programming language

r/nim

4
Posted by8 hours ago

after upgrading to ubuntu 22.04 i immediately realized nim doesnt like the prepacked ssl3, and theres not a way to degrade to 1.1, so im stuck without my favorite programming language

there are 2 issues on github regarding this (one one choosenim) and none of them are regarded as "high priority"

any ideas how i could get nim to work?

4
3 comments
Vote
promoted
View Comments
Play
0:00
0:00
Settings
Fullscreen
Vote
0 comments
5
Posted by1 day ago

I've read on the official site that Nim compiler (or rather transpiler) is written in Nim itself. Does it mean it's theoretically possible to compile the compiler to work in the browser? It may sound stupid but I've always dreamed of having a somewhat functional IDE right in the browser, without the server compiling and running the code and sending it to the browser.

I have just only discovered Nim a few days ago, so tell me if I'm saying something stupid.

5
6 comments
11
Posted by5 days ago

Context: I'm trying to make a digital choose-your-own-journey (CYOA, see also the goosebumps versions) reader. EDIT: Well, by "reader" I mean for making new stories (though maybe possible to get existing stuff if you could automatically convert it somehow).

I don't necessarily need a dynamic number of options, but would be nice to not type out manually (especially if I allow for a high number of options).

I'm looking to create objects with numbers. Like object1 object2 object3 etc so I can then assign their values (description, button text, link) when reading the corresponding line in the text file.

My first try was stringify ($), also parseInt etc but when it actually reads the name it instead gives

implicit object field construction requires a .partial object, but got string

Is something like this even viable? Or would the best I could get be to create 10 options manually or via metaprogramming (or directly with a range?) and then just ignore the ones that aren't needed?

11
9 comments
19
Posted by8 days ago

Hi,

Does anyone know how to check if a domain is alive or not?

I would preferably get a response like the host command on most Linux systems:

╭─[email protected] ~
╰─$ dig thisdomaindoesntexist.com

; <<>> DiG 9.10.6 <<>> thisdomaindoesntexist.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 16767
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 1
[...]
19
2 comments
5
Posted by9 days ago

Why is the local function draw not able to be called with the dot syntax (which means no chain calls, etc) I have also tried to change the name of the function so I can say for sure it is not the name.

Is it something I did wrong or should be implemented differently?


import csfml, csfml/ext
import complex
type seq2d = seq[array[2,float]]

proc line(vs:seq2d): VertexArray=
    result=newVertexArray(PrimitiveType.LineStrip)
    for i in 0..<vs.len:
        result.append vertex(vec2(vs[i][0], vs[i][1]), Blue)
        
proc draw(window:RenderWindow, vs:seq2d)=
    let l=vs.line
    window.draw l #works perfectly fine in any case, this is from csfml module
    l.destroy
5
2 comments
7
Posted by11 days ago

Hi,

I'm trying to create a new process on Windows using startProcess. My goal is to pass input to that process (e.g. cmd.exe) and read the output after. I've tried reading the output like this, but the process seems to "hang":

import osproc
import streams

let process = startProcess("C:\\Windows\\System32\\cmd.exe")

var processOutput = process.outputStream.readAll
echo processOutput

discard cmdProcess.waitForExit()

process.close()

If anyone could point me in the right direction, it would be greatly appreciated! I'm new to nim, so please be kind... 🙂

7
3 comments

About Community

This is the Nim programming language subreddit, our official website is http://nim-lang.org
5.4k

Members

31

Online


Created Aug 18, 2014
r/nim topics

Moderators

Moderator list hidden. Learn More