님 (프로그래밍 언어)

위키백과, 우리 모두의 백과사전.


Nim
패러다임멀티 패러다임: 컴파일, 병행, 절차적, 명령형, 함수형, 객체 지향, 메타
설계자Andreas Rumpf
개발자Nim Lang Team[1]
발표일2008년(16년 전)(2008)
최근 버전2.0.4[2] 위키데이터에서 편집하기
최근 버전 출시일2024년 4월 16일(2일 전)(2024년 4월 16일)
자료형 체계정적,[3] 스트롱,[4] 추론, 구조적
변수 영역변수 범위
구현 언어님 (자체 호스팅)
플랫폼IA-32, x86-64, ARM, Aarch64, RISC-V, PowerPC ...[5]
운영 체제크로스 플랫폼[6]
라이선스MIT[7][8]
파일 확장자.nim, .nims, .nimble
웹사이트nim-lang.org
영향을 받은 언어
에이다, 모듈라-3, 리스프, C++, 오브젝트 파스칼, 파이썬, 오베론, 러스트

(Nim)은 범용 목적다중 패러다임정적 자료형, 컴파일 시스템 프로그래밍 언어이다.[9] Andreas Rumpf 등이 소속된 팀이 설계하고 개발했다. 님은 컴파일 타임 코드 생성, 대수적 자료형, C, C++, 오브젝티브-C, 자바스크립트 등과 연계되는 외부 함수 인터페이스(FFI), 또 해당 언어들로의 컴파일 지원을 제공함으로써 메타프로그래밍, 함수, 메시지 전달, 절차, 객체 지향 프로그래밍 스타일을 지원하는 등 효율적이고 표현적이며 우아한 방식을 제공하도록 설계되었다.

문법 예시[편집]

# 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)

같이 보기[편집]

각주[편집]

  1. “Contributors to nim-lang/Nim”. 2022년 3월 23일에 확인함. 
  2. https://github.com/nim-lang/Nim/releases/tag/v2.0.4.
  3. “Nim by example”. 《GitHub. 2014년 7월 20일에 확인함. 
  4. Караджов, Захари; Станимиров, Борислав (2014). 《Метапрограмиране с Nimrod》. VarnaConf (불가리아어). 2014년 7월 27일에 확인함. 
  5. “Packaging Nim”. 2022년 3월 23일에 확인함. 
  6. “Install Nim”. 2018년 10월 12일에 확인함. 
  7. “FAQ”. 《nim-lang.org》. 2015년 3월 27일에 확인함. 
  8. “copying.txt”. 《GitHub》. 2015년 3월 27일에 확인함. 
  9. Rumpf, Andreas (2014년 2월 11일). “Nimrod: A new systems programming language”. 《Dr. Dobb's Journal. 2014년 7월 20일에 확인함. 

외부 링크[편집]