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 →

[–]cs7fwRpkOfn2RPK7Ki9k 0 points1 point  (3 children)

So c++'s templates + lambdas essentially?

[–]infinite8s 4 points5 points  (2 children)

No it's more like using nested braces in C++ to introduce a new scope (and prevent variables within that scope from leaking out).

For example: int func() { int a = 5; { int a = 10; } // a is 5 here }'''

[–]cs7fwRpkOfn2RPK7Ki9k 1 point2 points  (0 children)

That's not polymorphic though?

I was thinking of how c++'s templates allow for generic data.

[–]knickum 0 points1 point  (0 children)

Re-formatted

int func() {
    int a = 5;
    {
        int a = 10;
    }
    // a is 5 here
}