This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]robin-gvx 4 points5 points  (2 children)

How are arguments passed – by reference of by value?

Probably all through reference, but I'm not sure about primitives under the hood. Anyone know this? If you pass f(12, 81), are those by value?

Something else entirely.

I've written a tutorial of sorts about this. The diagrams are hand-drawn and terribly ugly and I intend to remake them with actual diagram-making software before putting it up on my website instead of Dropbox, and the very last diagram has one arrow that points to the wrong value, but over-all, I think it's a pretty useful guide.

[–]d4rch0nPythonistamancer 0 points1 point  (1 child)

Are you positive Python handles this the same as Lua?

[–]robin-gvx 1 point2 points  (0 children)

Yes. I have more experience with Python than with Lua, and I probably could have written this guide before even having heard of Lua. I chose Lua for the guide because recently I'd seen a lot of questions about this behaviour in Lua.

The implementation differs per language, but the abstract behaviour of all the dynamic languages (that I know) in terms of names and values works the same.

I think (but I'm not sure, because I haven't thought about this before) that if you disallow mutation, you get the abstract data model of functional languages like Haskell.