SlideShare ist ein Scribd-Unternehmen logo
1 von 33
Downloaden Sie, um offline zu lesen
The Nim programming
language
unified.diff
Disclaimer
Here be
contrary
opinions!
The Joy of Ruby
5.times { print "Odelay!" }
exit unless restaurant.menu.include? "kebab"
meringue = ['egg', 'sugar', 'milk'].reduce &:+
90% = good enough
10% =
performance ||
concurrency ||
parallelism
The trouble with C(++)
❏ int (*(*func())[10])()
❏ 1 / 0;
❏ char s[ ] == char *s == std::string == LPSTR
== wchar
❏ int myInt = 0; fileStream.read
(reinterpret_cast<char*>(&myInt), sizeof(int));
❏ void myfunc() { char *c = malloc(16); }
Hello world!
puts "hello world!" Ruby
print "hello world!" Python
#include <iostream> C++
int main()
{
std::cout << "hello world!n";
return 0;
}
fn main() { Rust
println!("Hello world!");
}
package main Go
import "fmt"
func main() {
fmt.Println("hello world!")
}
Language bureaucracy
public class HelloWorld { Java
public static void main(String[] args) {
System.out.println("Hello, World");
}
}
using System; C#
namespace HelloWorld
{
class Hello {
static void Main() {
Console.WriteLine("Hello World!");
}
}
}
Quest for a new system-level language
Requirements:
● Safe
● Portable
● Performant
● Expressive
● Elegant
Candidates:
1. Rust
2. Go
3. Nim
© Nim In Action, Dominik Picheta, Manning Publications, 2016
Portability
● Nim → Backend (C, JS)
● Backend → Nim (C, JS)
● c2nim = Parse a C file and generate equivalent
Nim code
Interoperability
Statically typed + variable state
● Statically typed / type inference
● Immutable / mutable variables
● whitespace-significant
Types and variables
● Non-tracing GC
● Can be customised
○ GC_setMaxPause(MaxPauseInUs: int)
○ GC_step(us: int, strongAdvice = false, stackSize = -1)
● Can be turned off
○ GC_disable()
Garbage Collection
Functions
Functions: UFC
Function: overloading
Generics
First-class Functions
● First-class citizens
● Closures
● Implicit returns
● Immutable arguments
● Overloading
● Uniform Function Call
● Style-indifferent
Functions
Modules
person.nim
main.nim
● Arrays
● Sequences
● Objects
● Tuples
● Sets
Structured Types
Modules
Functional programming
Side-effect checking
Built-in functional style
Templates as DSLs
Templates can access AST
Macros
Threads
NimScript
Any questions?
Ping me at:
FredAtBootstrap
fred@bootstrap.me.uk

Weitere ähnliche Inhalte

Was ist angesagt?

What is python
What is pythonWhat is python
What is python
EU Edge
 
zshと仮想端末マネージャで快適ターミナル生活
zshと仮想端末マネージャで快適ターミナル生活zshと仮想端末マネージャで快適ターミナル生活
zshと仮想端末マネージャで快適ターミナル生活
Nobutoshi Ogata
 
completion_proc and history
completion_proc and historycompletion_proc and history
completion_proc and history
Nobuhiro IMAI
 
Powerpoint switch1
Powerpoint switch1Powerpoint switch1
Powerpoint switch1
jaypeebala
 

Was ist angesagt? (20)

What is python
What is pythonWhat is python
What is python
 
Sol8
Sol8Sol8
Sol8
 
zshと仮想端末マネージャで快適ターミナル生活
zshと仮想端末マネージャで快適ターミナル生活zshと仮想端末マネージャで快適ターミナル生活
zshと仮想端末マネージャで快適ターミナル生活
 
Using the Command Line with Magento
Using the Command Line with MagentoUsing the Command Line with Magento
Using the Command Line with Magento
 
Bash Scripting
Bash ScriptingBash Scripting
Bash Scripting
 
Sol9
Sol9Sol9
Sol9
 
Game Analytics Cluster Scheduler
Game Analytics Cluster SchedulerGame Analytics Cluster Scheduler
Game Analytics Cluster Scheduler
 
File Handling Program
File Handling ProgramFile Handling Program
File Handling Program
 
App-o-Lockalypse now!
App-o-Lockalypse now!App-o-Lockalypse now!
App-o-Lockalypse now!
 
completion_proc and history
completion_proc and historycompletion_proc and history
completion_proc and history
 
JSUG - Scala Lightning Talk by Michael Greifeneder
JSUG - Scala Lightning Talk by Michael GreifenederJSUG - Scala Lightning Talk by Michael Greifeneder
JSUG - Scala Lightning Talk by Michael Greifeneder
 
Python para web - Utilizando micro-framework Flask - PUG-MA
Python para web - Utilizando micro-framework Flask - PUG-MAPython para web - Utilizando micro-framework Flask - PUG-MA
Python para web - Utilizando micro-framework Flask - PUG-MA
 
Powerpoint switch1
Powerpoint switch1Powerpoint switch1
Powerpoint switch1
 
Multithreading in PHP
Multithreading in PHPMultithreading in PHP
Multithreading in PHP
 
関西Vim勉強会#5 vimrcの書き方
関西Vim勉強会#5 vimrcの書き方関西Vim勉強会#5 vimrcの書き方
関西Vim勉強会#5 vimrcの書き方
 
dplyr
dplyrdplyr
dplyr
 
Seu primeiro loop com Python AsyncIO - TDC 2016
Seu primeiro loop com Python AsyncIO - TDC 2016Seu primeiro loop com Python AsyncIO - TDC 2016
Seu primeiro loop com Python AsyncIO - TDC 2016
 
Groovy
GroovyGroovy
Groovy
 
Memory Management in WordPress
Memory Management in WordPressMemory Management in WordPress
Memory Management in WordPress
 
A toolbelt of seasoned bug hunter - Damir Zekic
A toolbelt of seasoned bug hunter - Damir ZekicA toolbelt of seasoned bug hunter - Damir Zekic
A toolbelt of seasoned bug hunter - Damir Zekic
 

Ähnlich wie Introduction to Nim

Code as data as code.
Code as data as code.Code as data as code.
Code as data as code.
Mike Fogus
 
Marrow: A Meta-Framework for Python 2.6+ and 3.1+
Marrow: A Meta-Framework for Python 2.6+ and 3.1+Marrow: A Meta-Framework for Python 2.6+ and 3.1+
Marrow: A Meta-Framework for Python 2.6+ and 3.1+
ConFoo
 
Programming For Designers V3
Programming For Designers V3Programming For Designers V3
Programming For Designers V3
sqoo
 

Ähnlich wie Introduction to Nim (20)

Dts x dicoding #2 memulai pemrograman kotlin
Dts x dicoding #2 memulai pemrograman kotlinDts x dicoding #2 memulai pemrograman kotlin
Dts x dicoding #2 memulai pemrograman kotlin
 
Lesson 10
Lesson 10Lesson 10
Lesson 10
 
Introduction to rust: a low-level language with high-level abstractions
Introduction to rust: a low-level language with high-level abstractionsIntroduction to rust: a low-level language with high-level abstractions
Introduction to rust: a low-level language with high-level abstractions
 
C Tutorials
C TutorialsC Tutorials
C Tutorials
 
为什么 rust-lang 吸引我?
为什么 rust-lang 吸引我?为什么 rust-lang 吸引我?
为什么 rust-lang 吸引我?
 
Coffee scriptisforclosers nonotes
Coffee scriptisforclosers nonotesCoffee scriptisforclosers nonotes
Coffee scriptisforclosers nonotes
 
Code as data as code.
Code as data as code.Code as data as code.
Code as data as code.
 
Python
PythonPython
Python
 
Python programming lab14
Python programming lab14Python programming lab14
Python programming lab14
 
'C' language notes (a.p)
'C' language notes (a.p)'C' language notes (a.p)
'C' language notes (a.p)
 
Problemas de Arreglos en c++
Problemas de Arreglos en c++Problemas de Arreglos en c++
Problemas de Arreglos en c++
 
5 c control statements looping
5  c control statements looping5  c control statements looping
5 c control statements looping
 
Go Lang Tutorial
Go Lang TutorialGo Lang Tutorial
Go Lang Tutorial
 
Perkenalan ReasonML
Perkenalan ReasonMLPerkenalan ReasonML
Perkenalan ReasonML
 
Libtcc and gwan
Libtcc and gwanLibtcc and gwan
Libtcc and gwan
 
Libtcc and gwan
Libtcc and gwanLibtcc and gwan
Libtcc and gwan
 
Intro to c programming
Intro to c programmingIntro to c programming
Intro to c programming
 
Introduction to ReasonML
Introduction to ReasonMLIntroduction to ReasonML
Introduction to ReasonML
 
Marrow: A Meta-Framework for Python 2.6+ and 3.1+
Marrow: A Meta-Framework for Python 2.6+ and 3.1+Marrow: A Meta-Framework for Python 2.6+ and 3.1+
Marrow: A Meta-Framework for Python 2.6+ and 3.1+
 
Programming For Designers V3
Programming For Designers V3Programming For Designers V3
Programming For Designers V3
 

Mehr von Fred Heath

Mehr von Fred Heath (7)

Agile software requirements management with Impact Mapping and BDD
Agile software requirements management with Impact Mapping and BDDAgile software requirements management with Impact Mapping and BDD
Agile software requirements management with Impact Mapping and BDD
 
Nim programming language - DevFest Berlin 2019
Nim programming language -  DevFest Berlin 2019Nim programming language -  DevFest Berlin 2019
Nim programming language - DevFest Berlin 2019
 
USP Estimation - SwanseaCon 2016
USP Estimation - SwanseaCon 2016USP Estimation - SwanseaCon 2016
USP Estimation - SwanseaCon 2016
 
Port80: the uncertainty principle
Port80: the uncertainty principlePort80: the uncertainty principle
Port80: the uncertainty principle
 
Agile diff usp
Agile diff uspAgile diff usp
Agile diff usp
 
Design Patterns the Ruby way - ConFoo 2015
Design Patterns the Ruby way - ConFoo 2015Design Patterns the Ruby way - ConFoo 2015
Design Patterns the Ruby way - ConFoo 2015
 
User Story Point estimation method at ConFoo 2015
User Story Point estimation method at ConFoo 2015User Story Point estimation method at ConFoo 2015
User Story Point estimation method at ConFoo 2015
 

Kürzlich hochgeladen

Kürzlich hochgeladen (20)

A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 

Introduction to Nim