CompUnit
CompUnit
프로그램을 실행하다 보면 "지금 실행 중인 코드 조각이 어느 파일에서 왔고, 어떤 권한으로 만들어진 건지" 같은 메타 정보가 필요할 때가 있어요. Raku는 그런 정보를 CompUnit이라는 객체로 정리해 둡니다.
본문
CompUnit은 한 컴파일 단위(compilation unit)에 대한 메타 정보를 나타내요. 보통은 EVAL 문으로 실행되는 코드보다는, 파일시스템의 어떤 파일에 존재하는 소스 코드와 관련된 정보예요.
class CompUnit {}
메서드
method auth
method auth(--> Str:D)
CompUnit 객체가 생성될 때 부여된 권한(authority) 정보를 돌려줘요. 없으면 해당 없음이 나오죠.
method distribution
method distribution(--> Distribution:D)
CompUnit 객체가 생성될 때 함께 만들어진 Distribution 객체를 돌려줘요.
method from
method from(--> Str:D)
CompUnit 객체가 생성될 때 사용된 언어의 이름을 돌려줘요. 기본값은 Raku예요.
method precompiled
method precompiled(--> Bool:D)
CompUnit 객체가 미리 컴파일된(precompiled) 소스에서 왔는지 여부를 돌려줘요.
method repo
method repo(--> CompUnit::Repository:D)
CompUnit 객체가 생성될 때 함께 만들어진 CompUnit::Repository 객체를 돌려줘요.
method repo-id
method repo-id(--> Str:D)
연결된 저장소(repo) 안에서 CompUnit 객체를 식별할 수 있는 식별 문자열을 돌려줘요.
method short-name
method short-name(--> Str:D)
CompUnit 객체가 생성될 때 쓰인 짧은 이름을 돌려줘요.
method version
method version(--> Version:D)
CompUnit 객체가 생성될 때 부여된 버전 정보를 돌려줘요.