Variables and Scope in Digital Classics
Here are my closing remarks from the LAWDNY Digital Antiquity Research Workshop at the Institute for the Study of the Ancient World on December 2, 2016.
I am hoping that you will indulge me in an extended metaphor that came to mind as I was setting the schedule for today’s workshop — namely, a word about the variables and scope. I am a classicist by training and a programmer by accident. Still it has been a slow-going, deliberate accident of constant application, experimentation, and growth — more self-trial & error than self-taught—and to move ahead as a practicing digital classicist, I have had to spend my time immersed in programming manuals, coding tutorials, etc. So, concepts like scope have become second nature in how I organize my procedural knowledge of the world. I will first try to break the concept down into its basics before saying a few words about today’s workshop.
Variables are reserved words, or names, that a programmer can assign to objects in their code: x = 10 or filename = ‘data.txt’. You can assign objects to variables as a shorthand — that is, they stand in for changing entities or quantities that you need to keep track of as you work through the rest of your code. There is also a human aspect to variables — they allow complicated ideas to be distilled to more concise, easy-to-remember names.
Now, where a variable is declared in the code matters — and this will be an oversimplification for the sake of this talk, but the larger point should be clear. There are outer and inner layers of code and where you declare a variable establishes the variable’s scope. Allow me to explain. Let’s say you fire up a Python interpreter and type
x = 10
You now have a variable with global scope. If we then write:
x = x + 10
x now evaluates as 20 and will continue to refer to this amount elsewhere in the interpreter.
This is true except in the case of functions. Functions are blocks of reusable code (similar in some respects to variables in that we assign names to functions to make them easier to recall and so that they will be simple points of reference for more complicated ideas) If I define a function, say:
and declare a variable inside of this function, it is not global, but local. I can declare
x = 30
inside the function and we know have two x’s, global x = 20 and local x = 30. The local variable exists only within the function and it does well-defined, important work at a specific moment in time, i.e. when the function is called.
Now this is all well and good, but what does this have to do with our work here today? Well, when the LAWDNY Digital Antiquity Research Workshop was first planned, it was meant to be a local event. The NY of LAWDNY refers to New York — Linked Ancient World Data New York — and the idea was to create a space for conversation about digital classics projects in the tristate area. Something interesting and wonderful happened when the CFP was announced — we received immediate responses not just from New York City, not just from New York state, New Jersey, Connecticut, etc. but from all throughout the country. (We also had some inquiries about transatlantic presentations via Skype.) What became clear is that with today’s social-media extended scholarly network, there is no true local. Our work, our reach, our impact is at all times global.
So, what to make of a regional event like this? I started to conceive of today’s LAWDNY workshop as a function. (I suppose it is a function, in a sense of the word — it is funny how transferable these computing conceits can be!) That would make you — and I mean this sincerely and in terms of the highest regard — variables. Your presence here and your papers on digital philology, digital pedagogy, digital cultural heritage, digital scholarship of all varieties, has made this workshop a singular event, a unique moment in which these specific ideas have been introduced and put into dialogue.
Back to the metaphor — this function has been called. Your ideas came in as parameters, did their local work, but are now being returned to global scope changed by today’s event. That is the thing with locally scoped variables — the outer level does not have direct access to them, but functions (and so by extension their moving parts, variables included) can have a material effect on what is being done at the global level.
Python — and I only bring up Python because I know it best — has a keyword “global” that takes variables declared in local scope and makes them available everywhere. So I invite you all to use this “global” keyword, so to speak, and take everything that was declared here today over the last seven hours back to you home campuses and keep pushing the envelop of digital classics.
We’ll hold LAWDNY 2017 at ISAW next year and the local variables will likely be different. (You’re all of course invited to submit again! We’d love to have you back to take part in the continuing conversation.) But as I hope my extended coding metaphor has suggested, the local and the global are inevitably and invariably intertwined. Not only does global work has impact on what we do locally, but also our local work, like what we’ve accomplished today together in this room, has impact on what we do globally. Thank you.