Re: Communication of the Nim language

2019-04-22 Thread dom96
I like the idea of examples aimed at various use cases: web dev, game dev, 
scientific dev etc. It would be good to have this on the front page. If someone 
wants to implement that then you have my blessing.

@sirbroadwell thank you for writing this. It's good to spark these kinds of 
discussions. I see you mentioning articles on medium, please consider writing 
some articles yourself, our community needs to help us get Nim more popular :)


Re: type mismath in simple math

2019-04-22 Thread cantanima
I think that this is the best solution, and it just so happens to be consistent 
other languages (Java and Kotlin come to mind).


import math

echo 2f^2*2.0


Run

You could even do this: 


import math

echo 2f^2*2


Run

> However, the following code will raise an error as type mismatch...

It _is_ a type mismatch, so, **good**. I 've had it with languages whose 
solution for easily preventable errors is `Segmentation fault` or `Bus error`, 
especially when those errors could be caught at compile time.


Re: type mismath in simple math

2019-04-22 Thread lscrd
To add to _mratsim_ answer, you can also write:


import math

echo 2.0^2 * 2.0


Run

and even:


import math

echo 2.0^2 * 2


Run

In the latter code, the compiler convert 2 to 2.0 as it knows that a float is 
expected. So, there is some flexibility though.


Re: type mismath in simple math

2019-04-22 Thread mratsim
Nim is statically typed, meaning it checked at compile-time that you are not 
mixing apples and oranges unless you specifically allows that.

That is because mixing types (integers and booleans, floats and integers) or 
quantities (miles and meters) is a big source of bugs in weakly typed languages.

You can import the `lenientops` module if you want less strict math operators:


import math, lenientops

echo 2^2*2.0


Run


Re: jester: Can't access javascript or css files

2019-04-22 Thread stevewilliam007
When I was trying to install the software the script loading failed. I have 
checked 
[https://itunessupport.org/blog/cannot-install-itunes-on-windows-7](https://itunessupport.org/blog/cannot-install-itunes-on-windows-7)
 for the solution of the problem and got to know about it. Please help me to 
fix the problem.


Re: Communication of the Nim language

2019-04-22 Thread sirbroadwell
Be careful, setting an example with a concrete goal helps to imagine how you 
can use the language and ease of implementation

The HTTP server is a good example to show it

Moreover, this does not mean in any way that the language can only do 
webdev many companies use Crystal for machine learning for example ^^^

Like many others use Elixir for game servers


Re: Communication of the Nim language

2019-04-22 Thread jrfondren
After reading this thread the other day I spent some hours building the website 
and learning about jekyll/liquid and preparing some code samples that were at 
least somewhat varied and that fit into the rather small space the website 
gives to the code.

But when I got to the CSS crafting stage, I decided this was a bad idea. The 
idea I had in mind was [https://dlang.org](https://dlang.org)/ 's selection 
menu with lots of different code samples. I think that's completely doable with 
the current website. But, do you really want to do it? Look around. Can you 
find any other programming language page that has a display like dlang's?

I looked around, and my favorite code samples were those in the form of a 
normal webpage. Click a link, there's some code, there's some prose talking 
about the code, and you can just scroll down the page to get more examples, 
with earlier prose helping to explain later examples. Meanwhile, on dlang.org 
you have to fiddle with HTML UI elements to make random-access selections from 
a list, with no explanation.

The popular thing to do now is to link to Rosetta Code. And nim-lang.org does 
that. And although that gives the reader a huge list of 
possibly-individually-interesting links to look at, RosettaCode is not at all 
optimized to make a language look good. I think the code example we have now is 
fine, and the easiest enhancement would be to replace the RosettaCode link with 
a link to a tour of Nim that has what you're hoping to get out of a bunch of 
code examples on the front page.

That's something anyone could do. If it's not done when another weekend rolls 
around I might try again at this. Start with something like your own blog 
entry. Theme: sell Nim with sample code.

But if you want something _really_ cool, look at 
[https://www.haskell.org](https://www.haskell.org)/ . I don't think they pull 
it off that well, and it's not yet a good fit for Nim or for nim-lang.org. But 
it's certainly attention-getting.