3 ms·
> Your article is confused between code walking (recognition of forms) and evaluation order. Yes, to some extend. > Can you assume that * X is a pointer deref
by heinrichhartman 8y ago
> Your article is confused between code walking (recognition of forms) and evaluation order.
Yes, to some extend.
> Can you assume that * X is a pointer dereference?
[Aside: The C declaration syntax is particularly terrible.
In a declaration 'star' means "address of", elsewhere it means "dereference". https://books.google.de/books?id=bXGhBAAAQBAJ&printsec=frontcover&dq=21st+century+C+pointer+declaration+syntax&hl=en&sa=X&ved=0ahUKEwjil_ShpYTeAhWNiKYKHfZ5CAYQ6AEIJzAA#v=onepage&q=21st%20century%20C%20pointer%20declaration%20syntax&f=false https://books.google.de/books?id=bXGhBAAAQBAJ&printsec=front...]
> I can't think of any language in which I can extract any substring of a sentence that could be a syntactic unit on its own, and correctly understand its meaning without knowing the rest of the sentence.
Well, most languages have expressions/statements that roughly correspond to source lines. When I read a line of python like this:
self.raw_requestline = self.rfile.readline(65537)
https://github.com/django/django/blob/master/django/core/servers/basehttp.py#L139 https://github.com/django/django/blob/master/django/core/ser...
I can be 100% sure that:
- `self` is an object with an attribute rfile
- `=` is the assignment operator
- there is a method `readline` that get's called with an integer argument 65537.
All this without checking any enclosing socpes.
A random line of lisp:
(setcdr current (list :args (cdr current)))
https://github.com/emacs-mirror/emacs/blob/master/lisp/wid-edit.el#L742 https://github.com/emacs-mirror/emacs/blob/master/lisp/wid-e...
could mean anything depending on the enclosing scopes.
Pretty sure setcdr,list,cdr are function calls but who knows. You don't have enough information to decide this from the snippet provided.
- kbp 8y ago> I can be 100% sure that: `self` is an object with an attribute rfile, `=` is the assignment operator, there is a method `readline` that get's called with an integer argument 65537. I think this is overstating things, eg, the class `self` belongs to might have defined __getattribute__, __setattr__, etc, so the things you know for 100% certain about that line of code in isolation don't really tell you anything about what it does (self does not definitely have that attribute, and that might not be assignment, at least); most of that you assume based on common sense, conventions, figuring the code is "normal", etc, the same as in Lisp. And that's ignoring a trivial case like if the previous line was `f('''`, where f may or may or not call eval.