Loading AI tools
위키백과, 무료 백과사전
님(Nim)은 범용 목적의 다중 패러다임의 정적 자료형, 컴파일 시스템 프로그래밍 언어이다.[9] Andreas Rumpf 등이 소속된 팀이 설계하고 개발했다. 님은 컴파일 타임 코드 생성, 대수적 자료형, C, C++, 오브젝티브-C, 자바스크립트 등과 연계되는 외부 함수 인터페이스(FFI), 또 해당 언어들로의 컴파일 지원을 제공함으로써 메타프로그래밍, 함수, 메시지 전달, 절차, 객체 지향 프로그래밍 스타일을 지원하는 등 효율적이고 표현적이며 우아한 방식을 제공하도록 설계되었다.
패러다임 | 멀티 패러다임: 컴파일, 병행, 절차적, 명령형, 함수형, 객체 지향, 메타 |
---|---|
설계자 | Andreas Rumpf |
개발자 | Nim Lang Team[1] |
발표일 | 2008년 |
최근 버전 | 2.0.8[2] |
최근 버전 출시일 | 2024년 7월 3일 |
자료형 체계 | 정적,[3] 스트롱,[4] 추론, 구조적 |
변수 영역 | 변수 범위 |
구현 언어 | 님 (자체 호스팅) |
플랫폼 | IA-32, x86-64, ARM, Aarch64, RISC-V, PowerPC ...[5] |
운영 체제 | 크로스 플랫폼[6] |
라이선스 | MIT[7][8] |
파일 확장자 | .nim, .nims, .nimble |
웹사이트 | nim-lang |
영향을 받은 언어 | |
에이다, 모듈라-3, 리스프, C++, 오브젝트 파스칼, 파이썬, 오베론, 러스트 |
# Let's declare a function that takes any type of number and displays its double
# In Nim functions with side effect are called "proc"
proc timesTwo(i: SomeNumber) =
echo i * 2
# Let's write another function that takes any ordinal type, and returns
# the double of the input in its original type, if it is a number;
# or returns the input itself otherwise.
# We use a generic Type(T), and precise that it can only be an Ordinal
func twice_if_is_number[T: SomeOrdinal](i: T): T =
when T is SomeNumber: # A `when` is an `if` evaluated during compile time
result = i * 2 # You can also write `return i * 2`
else:
# If the Ordinal is not a number it is converted to int,
# multiplied by two, and reconverted to its based type
result = (i.int * 2).T
echo twice_if_is_number(67) # Passes an int to the function
echo twice_if_is_number(67u8) # Passes an uint8
echo twice_if_is_number(true) # Passes a bool (Which is also an Ordinal)
Seamless Wikipedia browsing. On steroids.
Every time you click a link to Wikipedia, Wiktionary or Wikiquote in your browser's search results, it will show the modern Wikiwand interface.
Wikiwand extension is a five stars, simple, with minimum permission required to keep your browsing private, safe and transparent.