변수가 존재하지 않으면 그 변수는 스코프 안에 ‘있지 않음’을 직관적으로 알 수 있습니다. 즉,
아직 선언하지 않은 변수나 함수가 종료되면서 존재하지 않게 된 변수는 분명 스코프 안에 ‘있
지 않습니다’.
그건 무슨 뜻일까요? 변수가 스코프 안에 있지 않다면, 그 변수는 존재하지 않는다는 말일까
요? 꼭 그런 건 아닙니다. 그리고 여기서
스코프
와
존재
를 반드시 구별해야 합니다.
가시성
visibility
이라고도 불리는 스코프는 프로그램의 현재 실행 중인 부분, 즉
실행 컨텍스
트
execution
context
에서 현재 보이고 접근할 수 있는 식별자들을 말합니다. 반면 존재한다는 말은
그 식별자가 메모리가 할당된(예약된) 무언가를 가리키고 있다는 뜻입니다. ...
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.