Zulip Chat Archive

Stream: maths

Topic: global variables


Arthur Paulino (Oct 27 2021 at 17:39):

Yeah I understand. It's very similar to writing things in mathematics. But from a software engineering perspective it's somewhat similar to using global variables, which forces the reader to either read everything from the very beginning or to scroll the code up and down a few times. But I can appreciate the trade-off in the context of a language for math

Kyle Miller (Oct 27 2021 at 17:53):

The #where command is helpful to see exactly which variables are in effect.

Kyle Miller (Oct 27 2021 at 17:58):

A problem with global variables is that this is state you have to reason about to be able to tell whether the code you're writing is correct, since any given function can change behavior depending on the value of a global. A nice thing about variables is that all it does is insert extra arguments, and when in doubt you can #check the type of a function or move your cursor to the beginning of a proof and look at the goal window.

Arthur Paulino (Oct 27 2021 at 18:03):

An interesting insight is that it's like moving towards the concept of live books, as opposed to static ones written on paper, pdfs or static html. And I am very fond of interactive media


Last updated: Dec 20 2023 at 11:08 UTC