Skip to content

Specify semantics of #ifTrue:/#ifFalse: and allow/disallow Smalltalk 80 style optimizations #100

Open
@smarr

Description

@smarr

Often Smalltalk implementations would special-case control structures to simplify implementations.

Personally, I think this isn't great. Though, I haven't bothered implementing it correctly either.

It would be good to specify the semantics, or, at the very least, explicitly have an example, and tests to ensure that #ifTrue: and similar are treated as pure messages, and any implementation optimization is not observable from the language itself.

See smarr/SOMpp#7 for further discussion.

@ltratt's example should work. I don't think there's any good justification for it not to work.

T = (
    ifTrue: x = ( ^2 )

    run = (
        (self ifTrue: 3) println.
    )
)

Metadata

Metadata

Assignees

No one assigned

    Labels

    language designThis issue requires design decisionsspecNeeds specification, or is specification related.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions