• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[vJASS] What's SCOPE on vJass. It use for?

Status
Not open for further replies.
Scopes:
- Everything inside a scope is private and cannot be accessed from the outside
- When you declare something public inside a scope, it will be moved outside the scope
so you can access it from other libraries and scopes.
- Scopes can be nested:

JASS:
scope Tro

    scope lolo

        scope lolol
        endscope

    endscope

endscope

I wouldn't recommend using scopes.
They make library requirements implicit (Meaning they don't make them clear)

Scopes are moved to the end of the map-script.
That's why they're ideal for spells.

Personally, I never use scopes because making implicit requirements is a bad programming practice.
I always use libraries so that I can specify the requirements within the code. Some say "Hey, you
can use a scope and put the requirements in the documentation". Well, reading the documentation
is extraneous (Thanks Bribe ^.^).
 
Status
Not open for further replies.
Top