은 변수 식별자로 취급하며, (클래스 이름 등) 대문자로 시작하는 토큰은 상수 식별자로 취
급한다. 이는 현재 패턴 매칭
case
식의 아주 간결한 문법(예를 들면
val
키워드를 패턴에 사
용하지 않는다)으로 인해 생기는 모호성을 해결하기 위한 규칙이다.
3.1.1
편의 구문
모든 연산자가 메서드라는 사실을 알고 나면, 낯설어 보이는 스칼라 코드를 이해하기가 쉬워진
다. 새 연산자를 볼 때마다 특별한 경우가 아닌지 고민할 필요가 없다.
1
.
4
절 ‘동시성 맛보기’의
액터는 비동기 메시지를 느낌표(!)를 사용해서 서로에게 보낸다. 하지만 이것도 일반적인 메서
드일 뿐이다.
이렇게 메서드 이름을 유연하게 부여할 수 있으므로, 스칼라 자체를 확장한 것처럼 자연스럽게
느껴지는 라이브러리를 만들 수 있다. 여러분은 모든 일반적인 수학 연산자를 사용할 수 있는
새로운 수 타입
numeric
type
을 제공하는 수학 라이브러리를 만들 수 있다. 액터와 똑같이 작동하
는 새로운 동시성 메시지 계층을 작성할 수도 있다. 단지 몇 가지 메서드 이름에 대한 제약 사항
만 그 가능성을 제한할 뿐이다.
CAUTION
_
여러분이 연산자 기호를 만들 수 있다고 해서 꼭 그걸 만들어야 한다는 의미는 아니다. 이상한
기호로 만들어진 연산자는 사용자들이 읽고 배우고 기억하기 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month, and much more.
O’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
I wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
I’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
I'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.