In something like C++ you could create a scope like so:

{
	// Do something neat here
}

I was wondering about having or maybe even requiring a scope keyword, which might look like this:

scope
{
	// Do something neat here
}

This seems even more relevant in an indentation sensitive language like python:

scope:
	pass

Interested to hear any opinions, TIA.

  • RonSijm@programming.dev
    link
    fedilink
    arrow-up
    7
    ·
    edit-2
    8 months ago

    A scope is already implied by brackets. For example, a namespace, class, method, if block are also scopes.

    So I don’t really see why you’d want an explicit scope keyword inside methods, when all other scopes are implied… That just creates an inconsistency with the other implied scopes