Discuss Scratch
- Discussion Forums
- » Bugs and Glitches
- » When naming a myBlock "constructor" it will not run, I changed the name to "hello" and it did run
- lolmaster1a
-
Scratcher
29 posts
When naming a myBlock "constructor" it will not run, I changed the name to "hello" and it did run
My browser / operating system: Windows NT 10.0, Chrome 118.0.0.0, No Flash version detected
Checked in offline and online won't run if myBlock is called constructor
Checked in offline and online won't run if myBlock is called constructor
- PcUserPro
-
Scratcher
500+ posts
When naming a myBlock "constructor" it will not run, I changed the name to "hello" and it did run
Just confirmed this bug.
- CST1229
-
Scratcher
1000+ posts
When naming a myBlock "constructor" it will not run, I changed the name to "hello" and it did run
I think this is due to JavaScript internals stuff (“constructor” is a default object property), though this is definitely a bug and is probably fixable. The same thing happens if you name a custom block any of the following:
- __proto__
- __defineGetter__
- __defineSetter__
- __lookupGetter__
- __lookupSetter__
- hasOwnProperty
- isPrototypeOf
- propertyIsEnumerable
- toLocaleString
- toString
- valueOf
- medians
-
Scratcher
1000+ posts
When naming a myBlock "constructor" it will not run, I changed the name to "hello" and it did run
Can replicate:



Also, on 2.0, it lets me run it but only if the define block is the only part running, so yea.
My browser / operating system: MacOS Macintosh X 10.15.7, Chrome 119.0.0.0, No Flash versions detected
My browser / operating system: MacOS Macintosh X 10.15.7, Waterfox Classic, Flash 32.0.0.371



Also, on 2.0, it lets me run it but only if the define block is the only part running, so yea.
My browser / operating system: MacOS Macintosh X 10.15.7, Chrome 119.0.0.0, No Flash versions detected
My browser / operating system: MacOS Macintosh X 10.15.7, Waterfox Classic, Flash 32.0.0.371
I think this is due to JavaScript internals stuff (“constructor” is a default object property), though this is definitely a bug and is probably fixable. The same thing happens if you name a custom block any of the following:I feel like I've seen a topic like this before, is there anything made to fix it on github?
Last edited by medians (Nov. 5, 2023 17:16:52)
- Discussion Forums
- » Bugs and Glitches
-
» When naming a myBlock "constructor" it will not run, I changed the name to "hello" and it did run



