#literals and #hasLiteral: not in sync

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

#literals and #hasLiteral: not in sync

Marcus Denker-4
Hi,

As you might now, we abuse the literals of compiled methods to hold on to the class and the literal. (and the place used to store the literal is used for
additional properties if there are some).

So right now we have the problem that #literals just returns all the literals and clients do “allButLast” to filter out the class binging, but they ignore the selector.

#hasLiteral: doe the filtering *and* it filters the last two. All quite confusing.

So, this is true:

(Object >> #yourself) literals includes: #yourself.
(Object >> #yourself) hasLiteralSuchThat: [ :lit | lit = #yourself].


but this is false:

(Object >> #yourself) hasLiteral: #yourself.
(Object >> #yourself) hasLiteralThorough: #yourself.

I suggest we make this simpler by:

-> #allLiterals return all the literals, even the abused last two
-> #literals returns what you think it should: the true literals of the method, without the last two abused fields.
-> fix all cases of “literals allButLast”, there are not many.


Is there any reason why this could be bad? 

Marcus
Reply | Threaded
Open this post in threaded view
|

Re: #literals and #hasLiteral: not in sync

Denis Kudriashov
Hi Marcus.

#literals and #allLiterals are good idea but maybe we can better distinguish them using more specific names like: 
- for all literals:  encodedLiterals or allEncodedLiterals
- for real literals: syntaxLiterals, semanticLiterals, userLiterals, sourceCodeLiterals

2018-06-08 11:17 GMT+03:00 Marcus Denker <[hidden email]>:
Hi,

As you might now, we abuse the literals of compiled methods to hold on to the class and the literal. (and the place used to store the literal is used for
additional properties if there are some).

So right now we have the problem that #literals just returns all the literals and clients do “allButLast” to filter out the class binging, but they ignore the selector.

#hasLiteral: doe the filtering *and* it filters the last two. All quite confusing.

So, this is true:

(Object >> #yourself) literals includes: #yourself.
(Object >> #yourself) hasLiteralSuchThat: [ :lit | lit = #yourself].


but this is false:

(Object >> #yourself) hasLiteral: #yourself.
(Object >> #yourself) hasLiteralThorough: #yourself.

I suggest we make this simpler by:

-> #allLiterals return all the literals, even the abused last two
-> #literals returns what you think it should: the true literals of the method, without the last two abused fields.
-> fix all cases of “literals allButLast”, there are not many.


Is there any reason why this could be bad? 

Marcus

Reply | Threaded
Open this post in threaded view
|

Re: #literals and #hasLiteral: not in sync

Marcus Denker-4


On 8 Jun 2018, at 12:42, Denis Kudriashov <[hidden email]> wrote:

Hi Marcus.

#literals and #allLiterals are good idea but maybe we can better distinguish them using more specific names like: 
- for all literals:  encodedLiterals or allEncodedLiterals
- for real literals: syntaxLiterals, semanticLiterals, userLiterals, sourceCodeLiterals


I am not sure. that looks even more complex to me.

2018-06-08 11:17 GMT+03:00 Marcus Denker <[hidden email]>:
Hi,

As you might now, we abuse the literals of compiled methods to hold on to the class and the literal. (and the place used to store the literal is used for
additional properties if there are some).

So right now we have the problem that #literals just returns all the literals and clients do “allButLast” to filter out the class binging, but they ignore the selector.

#hasLiteral: doe the filtering *and* it filters the last two. All quite confusing.

So, this is true:

(Object >> #yourself) literals includes: #yourself.
(Object >> #yourself) hasLiteralSuchThat: [ :lit | lit = #yourself].


but this is false:

(Object >> #yourself) hasLiteral: #yourself.
(Object >> #yourself) hasLiteralThorough: #yourself.

I suggest we make this simpler by:

-> #allLiterals return all the literals, even the abused last two
-> #literals returns what you think it should: the true literals of the method, without the last two abused fields.
-> fix all cases of “literals allButLast”, there are not many.


Is there any reason why this could be bad? 

Marcus