Interesthing
공유: Interactive C++ with Cling
iosroid
2020. 12. 1. 16:53
Interactive C++ with Cling
blog.llvm.org/posts/2020-11-17-interactive-cpp-with-cling
Cling has emerged as a recognized capability that enables interactivity, dynamic interoperability and rapid prototyping capabilities to C++ developers.
Cling supports the full C++ feature set including the use of templates, lambdas, and virtual inheritance.
Cling is an interactive C++ interpreter, built on top of the Clang and LLVM compiler infrastructure.
The interpreter enables interactive exploration and makes the C++ language more welcoming for research.
C++ 을 스크립트 처럼 쓰게 한다니...
interpreter 라니???
변수 값을 바로 변경하여 결과를 볼 수 있다...
각 입력의 표현식을 unique wrapper function 으로 만들고 global 로 scope 를 변경하여
다음 input 에서도 사용할 수 있게 만들어 준다고 한다...
3번째 입력줄에 만든 v 가 네번째 입력에서도 사용될 수 있게 해주는 원리인가 보다.
세미콜론(;)을 빼면 타입을 바로 출력해 준다.
변수값도 바로 출력.
변수 재정의가 가능하다.
정말 스크립트 같다.
입력이 바로 컴파일 되고 실행되니 에러도 바로 출력해준다.
어설프지만 .. add() 를 만들고
블로그의 코드 재사용? 예제를 따라했다..
아래의 int r = add(2, 4); 는 방향키로 이전에 입력한 것을 다시 입력 한 것이다.
그렇다고 C++ 특성이 바뀐것은 없다...
Cling has been one of the systems enabling interactive C++ for more than decade.
Cling’s extensibility and fast prototyping features is of fundamental importance for researchers in high-energy physics, and an enabler for many of the technologies that they rely on.
Cling has several unique features tailored to the challenges which comes with incremental C++.
In the next blog post we will focus on interactive C++ for Data Science; Eval-Style Programming; Interactive CUDA; and C++ in notebooks.
당연히 하루아침에 나온 기술은 아니었고...
Data Science 와 연구 쪽에서 사용되고 있는가 보다.
enable functionality which can provide native-like, dynamic runtime interoperability between C++ and Python (and eventually other languages such as Julia and Swift)
다른 언어와도 연동되게 할 계획이라고 한다. python 이 역시...
잼있는 프로젝트를 알게되었다.
자세하고 정확한 내용은 블로그를 읽어보시길.