Inheritance from parent

Yeah, I specified old text languages to try to avoid the confusion between metaprogramming and incremental development in an IDE. I think Jens is just about old enough to remember what I mean, but let me spell it out for you.

In the old days, programming language compilers didn't have any kind of editing capability built in. You edited your program in some external program, Emacs or (these days it'd be) TextEdit or Notepad (not a document formatter such as Word), and then ran it through the compiler. So there was no danger of the compiler modifying the program code. (Cf. Kernighan C compiler hack.) It's because of this history that when someone had the idea of combining the compiler with a special-purpose text editor that understands the language's syntax, they had to make up a name for it, "Integrated Development Environment."

The point of macros ("metaprogramming" has too many letters for me to keep typing it) is to extend the language. They let users be their own language designers. Using a macro capability to change the definition of an existing procedure is not what it's really for; it's to make a new syntax. As an analogy, imagine if raw Snap! let you have only one C-shaped slot in a block, but you could write a macro to allow more than one. That'd be inventing a new syntax. (I'm emphasizing syntax because in any reasonable language you can invent new semantics with plain old procedures; no need for macros. But yes, another use for macros is to invent programmatically a family of procedures not involving new syntax.)

What counts as syntax is way more complicated in a visual language than in a text language, whose programs are ultimately just text. Snap! 's macros don't let users define new block shapes, input slot shapes, or shapes period. But those shapes represent categories that can be invented in a text language. Maybe, over a long time, one by one, we'll end up feeling the need to invent macro-like graphics features. Or maybe not.

Indeed, Snap! metaprogramming (the part about letting you create a block) is an example of letting users do programmatically something they could always do in the UI. (The other half, letting you examine a block definition programmatically, isn't an instance of Eisenberg's Law.) But the point of the Law is that everything you can do in the UI should be doable in a program. For example, although Jens loves a programmable equivalent to the "Make a block" button, he hates the whole idea of a programmable equivalent to the "Make a variable" button. ¯\_(ツ)_/¯

I mean, I can see how there might be a few exceptions. Consider password managers, which let you see your saved passwords for different sites. Yeah, there probably shouldn't be a web API to retrieve those passwords programmatically. Maybe there are a few such exceptions for Snap!, too. But Eisenberg's Law says that by default, if you can do something in the UI, you should be able to do it in a program also. One reason to make it a Law is that if you're in the habit of thinking that way, you build your UI in a way that factors the actual doing of whatever it is from capturing the mouse click that tells the UI to do it, and then you can (using a macro! :~P) automate exposing the action in the programming language. It's the other direction that's hard, because you have to design an appropriate UI, a dialog box or a slider or whatever, for each action.

A while ago there was a thread asking for a block equivalent to the "pic" option in the stage's context menu
stage-context
Turns out there is such a block, kind of, but it's hidden in dev mode:


I say "kind of" because this makes a costume, rather than exporting the image, but there's also a block
untitled script pic (4)
in the Pixels library, and together they fill the need.

Why is it hidden in dev mode? By default every item in every context menu should have a block equivalent. That doesn't have to mean a zillion different blocks; there could be a block
untitled script pic (5)
in which the choices in the ITEM slot would depend on which menu was chosen in the MENU slot. Or something; this is an off-the-cuff idea rather than a careful design.

this answer is exactly the reason why I'm growing ever more reluctant about any sentence that posits that "everything should..."

If you want to build the programming language to end all programming language, fine, but it won't be Snap. Are you folks aware of what's being taught in schools to a whole class of kids who need to pass an exam afterwards, not just to the 2 exceptional boys who are gifted mathematicians already?

these a difference here i think in what is the goal, if the goal is strictly the grade, then the content is useless afterwards and will be forgotten. if the goal is to appease to these kids whose goal is to get the good grade, you are actively working towards helping these kid get to the point where they get to forget everything youve presented them with! if the goal is to really learn about programming, well, what is programming. im not going to get in to that super deep, im just going to say what i think, programming is making the computer do whatever you want it to. because thats what you can do. just about... so the goal here could be anything. some people want to make a game. some people want to make tools. some people want to see what happens when you do this with that or what about that with this. playing around, stretching their creativity past beyond the bounds of certainty. but now what happens when you get in the way of that goal? say your goal is to stop them from being able to do something. well now they think, 'they wont let me do this thing i want to do. i wonder how i can still do it anyway?'. and now youre actively working towards helping these kids want really bad to do this thing you dont want them to do. and the beautiful thing is this, snap is just a program, the only thing in the way of them doing the thing is them figuring out how to do it. and when you get someone like me, who actually knows a thing or two about programming, i just do the thing. no permission granted, wonderful, no permission needed! what i dont understand is why you want people not to be able to do what they want to do? am i getting this wrong because it doesnt feel right. but its what it seems like. i do want to believe your hearts in the right place but clearly its not getting through correctly

enable js (obviously)

edit: ok the second dropdown doesnt work with iframe. lol heres the project link. should work in the editor.

edit2: ok it work in the iframe but you have to move the block. lol. idk. but is this what you were talking about?

I love the way you did the [item] dropdown. I wouldn't have thought about putting a JavaScript function in there, but if it works, it works!

Yes, this is exactly what I‘m talking about, thank you. Imagine opening a project that all by itself changes the language, hides all blocks, constantly writes tons of files to your disk, etc. and think about what this would do to a classroom with one teacher and 25 kids getting to use Snap once for 40 mins per week. As you continue to discover, there is obviously nothing I‘m doing that prevents you from writing everything and anything you can imagine or want, and I‘m even giving you a JS function block (that‘s my proud invention, imagine that!) to make such extensions really easy and interactive to develop. I so don‘t understand all this bickering, all I‘m refusing is to include dangerous stuff that might cause kids to massively lose work or that might overwhelm users with unexpected behavior or cognitive load in the default configuration, and I do take issue with folks claiming that I should. Are you a teacher? Have you taught somebody else‘s curriculum (not your own fav project) to kids who have to be in your class and pass it wherher they want to or not? I want Snap to be a welcoming, inclusive and safe playground to learn powerful ideas in computing, not just something for the few savants who already know everything.

no i am not a teacher, havent taught someone elses curriculum to kids being forced to take it, i still think that accomplishes nothing... im not saying you did this shame on you but its really sad that something as joyous and fulfilling at least as i find it, is being used like this, kids have to do this, that take the fun all out of it. thats what makes people hate it, i hate doing what i have to do, especially if i know the only reason i have to do it is because someone else has the power to make me do it. all so employers who think they can milk the electricity out of the creative types can ground them and wonder why they arent being shocked..

i do love to teach people how to do something i know and they want to know, thats the best, most fun, most satisfying thing ever. and its easy. theres nothing in the way. theres also no pressure. if they change their mind and decide they hate it all is well. but schools i still feel like do an awful job at teaching children. maybe im just still not over the fact i wasted the majority of my time for 12 years sitting quietly learning how to pass my classes so i could immediately forget everything because i didnt care about it nor found it applicable in my own life. now im an adult and get to realize all the things i do need to know that i dont and pretty much have to figure out myself. but at least i know our first presidents name. go frickin me right.

I'm impressed by how little code that required!

It's a good start, but doesn't include context menus. That's much trickier. The hard part is specifying what menu you actually want without clicking on something. As a first attempt: Your Menu menu needs a "background of :arrow_forward:︎" submenu with entries stage, scripting area, and palette. Users should be able to ringify a block or script; if it's a single block maybe you should offer the union of that block's context menu when in a script and (then, after a horizontal rule) its context menu when in the palette. To make Jens happy, for all menus, filter out anything with "delete" in its name. :~) And your Menu menu should also include a submenu for each sprite with entries such as on stage, sprite corral, current costume... you get the idea. I suppose there should also be a Button choice in the Menu menu that lets you choose green flag, pause, stop, visible stepping, new sprite, paint new sprite, photo new sprite (we're leaving out the trash can). And a per-sprite submenu that gives you buttons such as Draggable, Revolve, Don't revolve, Face left-right only.

But also, all the items with "..." in their name open a dialog for the user to control something or other. In those cases you really want a third input slot for the user to put the value in. (Could be an expression that computes it.) And, you know, if the dialog has checkboxes, a way to check them.

All this extra complexity is a reason for Jens not to like the whole idea. If we were a text language instead of a block language we'd just have specific primitives for each thing a user can do. It's trying to minimize blocks that makes this hairy. There could be compromises such as SPRITE _ STAGE CONTEXT MENU ITEM _ as a block.

Probably you shouldn't actually do all this, so as not to cause Jens's head to explode. I'm just explaining my side of the argument, i.e., Eisenberg's Law.

Jens, I really, honestly, don't want to make you angry. I hate when that happens. (I mean, I hate when I make you angry. I want to be better at being able to express ideas without pushing your (or anyone's) buttons.)

But I've always thought we were agreed that we could meet everyone's needs, the 2 boys (who are occasionally girls, by the way) and the teacher of 30 (or of 3000, in peak years at Berkeley). That's why we reached the compromise of requiring turning on JS for this one library, so nobody would trip over it.

Nobody is asking for that. That's the point of requiring turning on JS. But I do think everything should be accessible, no matter how many handsprings you want users to have to do first.


You say "should" all the time, too, except more often it's "shouldn't," as in "people shouldn't use the variables library." :~/ We all have ideas about good and bad programming styles, but we decided early on that we're not Pascal, or even Racket; we don't enforce our opinions on users. I'm not saying you're doing that! But right now you're talking as if you were doing it: we have to restrict people to the style of work appropriate in a classroom.

Speaking of which, although I would express myself less vehemently than @cameron8299, especially right now when you're angry, I really don't believe in the way most classrooms work, as you know. When even you, who have right ideas about teaching, find yourself talking about passing exams as the reason things have to be a certain way, that shows me that the context in which you're teaching -- not your fault! -- is terrible. Your argument should be that some proposal gets in the way of kids understanding things, not that it gets in the way of them jumping through hoops. Cart before the horse. If we language designers, the curriculum designers, and the teachers are all doing our jobs, the kids will learn the ideas, and as a result they will pass the exam. Better still, we'll build learning environments without grades and exams. I know that won't be easy, and I'm not saying it glibly. It will require a huge movement among teachers, and take time. But still, I want to be part of that movement, marching in the street, not in the schoolhouse barricading the doors.


Anyway, the point of these getters and setters isn't to teach them to kids. If you recall, long ago, when I was working on tutorial videos (one more thing I have to get back to, groan) I wanted switching to the next part of the tutorial to be able to switch into or out of presentation mode. I think I did convince you to add that feature, although it must have been back in BYOB, because it doesn't seem to be in Snap!, which just shows you how long it's been since I worked on those videos. But when my psychiatrist finds the right medication and I get energetic, I'll want that again! That's the sort of use case I'm anticipating, and I don't think I know in advance exactly which setting other people's programs will have to change.

Social. It's a thing, you know. It's

and

that trigger my vehement objection. Your and a few others assumption that you "should" be able to do "whatever you want to do" in Snap, and that if there's anything that requires even so much as climbing over a fence - such as switching to dev mode or enabling JS-functions - then it must be evil. That's such a "Wild-West Cowboy" attitude! Your projects don't just run on your own device, they - often! - get shared with others, and that social community aspect calls for a fair balance between your desire for total control over your computer and your peers interest in not letting your project take over theirs.

I'm getting defensive when you give the impression that I'm "not letting" you do whatever you want in Snap. I even made it so that by friggin' default JS-functions are enabled(!!!) if you run Snap! locally, because in that case there is zero danger of them harming anybody else.

I actually somewhat agree that some things shouldn't be given to the programmer. Things like, logging in, opening a project, loading a library,, enabling javascript etc, might not be in the best interest to trigger via code. There are other things that I do think can be exposed without harm, like changing the stage size, codification, maybe even the generate puzzle function (which I still don't quite understand).

There has to be a line between what should and shouldn't be exposed to the programmer, as many things just don't make sense to expose, or are dangerous. After all, the snap IDE has an account system built into it, and you don't want your account to be haxked.

youre quoting "should" i havent used that word once. im going to argue about what 'should' / 'shouldnt' be as little as possible. im talking about what can be done and what will be done by those willing to do it.

maybe a bit of an exaggeration, but i guess a bit of insight into your perspective. let me do the same,

from what im gathering the great big evil for you is the malicious use of features that are too trusting towards the user, granting them potential means of wreaking havoc setting fires around the community site and blowing up computers in the classrooms.

i guess theres a balance to be met between providing an open enough space to exercise creativity while also a secure enough space to do so safely.

i dont think you should enable users to rewrite their machines operating system in snap. i also dont think you shouldnt. i would like the meta programming stuff simply because its fun and i am naturally inclined to implement these features myself. but this pretty much does only run on my device. ive shared things in the past that utilize the js block and add some feature, but then you have to trust some guys arbitrary javascript held together with tape and band aids to do what he says it does and, not take over your machine. set fires. what not.

and im talking about things that people want, people like, and snap lacks. like more input types that exist and are very clearly used in the primitive blocks. and whats the whole idea here, byob, but only jens gets to use the color picker in his blocks? the if else variadic block, i made before you did! but thats not portable, you cant use it in your projects. its not like a real block that you can save in your project and will load up again later. its just crazy to me that i have to go through all that just to build literally like one of the first blocks i wanted to make. so im all isolated here in my corner with my beloved js function block exercising the potential to wreak havoc but maintaining good will because ultimitely i find more satisfaction in making things that people want and like, but yet still remains the fact that nothing i make that is recognized in the default configuration nor will it be solid unless you decide to implement it in an update.

but just keep this in mind. as things are currently. i could write a malicious program in snap utilizing the js block, mask it as some fun program that people want to try, but really i dont know trick people into thinking they disconnected and need to log back in and you could see how this could become an issue. im not going to do that. at the same time nothing is stopping me from doing that. this is what i see as a safety concern. maybe someone driven by different motives might not be so pure in their intentions. your fixing potential injury by giving us this sharp medical equipment. 'do it yourself and dont hurt anyone'. letting people select menu items i dont know i feel like your concern may be a bit misaligned from the actual danger. but thats just what i think. im lacking your experience so, you know, grain of salt. sand. whatever.

ok so you want to go as far as including these menus:

Screen Shot 2024-03-20 at 4.23.16 AM

as well? i think if there were a way to just target objects (like actual morphs) it would literally be the exact same process. im sure thats not what you want but you know every individual block has its own context menu, certain multi input slots have a menu, you would need to be able to navigate through this. which is entirely feasible, ive done this to various extents before just playing around, heres that block rewritten in snap format (obv with some custom helpers)

these blocks are clearly meant to appeal to my own style and familiarity but the dot parenthesis format can stylized however fits snap. im pretty sure inside the %obj . %fn ( %...args ) block is literally just a call reporter. ditto with the block version with run.

and thats not even what youre getting at but im just saying imagine if you could implement this stuff literally in snap i mean talk about meta programming... i really love this kind of extensibility theres just so many hacks and workarounds required to even pretend its a thing.

edit: also i think it would be so cool if in the input editor how you have to write a javascript function and return a dictionary or options and yadda yadda, there was a block editor where you could build a script that returns the menu or even like to somehow define custom inputs / input types but idk im not gonna dream too hard.

That's actually the whole reason why the js block became disabled by default. There was someone who used the js block to fake the snap website, and collect user's passwords.

more slot types including color slots with color pickers are already in dev and been in there for a while. What frustrates beyond reason is that I keep adding features as fast as I can but the more features I add the more complaints I'm getting about allegedly missing things from ... this community gets me down in many ways, and worst of all is the tone of "of-course-ness" associated with these complaints.This sucks. Why don't y'all complain to Guido or Mitch about all your brilliant rules and laws that "of course" have to be obeyed by language designers?

Yeah, while we are disagreeing, nothing is going to happen in this direction. I was just saying what it would mean to take Eisenberg's Law really seriously, not suggesting that it be implemented right now

Because Guido and Mitch don't listen to users.

And also because nobody has said "of course" on this thread except you just now. But yes, I'm willing to say there are things language designers should do. I don't have to say it very often, these days, because (not counting Guido of course :~) ) language designers all understand the power of anonymous procedures in a language. (Instead, these days, I argue about case sensitivity with people I think of as colleagues, rather than enemies and/or idiots, namely the r7rs gang.)

Again, maybe I'm expressing myself badly. By "by default" I don't mean that everything is necessarily visible to the user in a fresh Snap!. Some things, for example, are in libraries. Some things, not just JS Function, are visible in the palette only if a box is checked in Settings. That's all fine.

If you actually look at all the context menus, you'll see that a surprising number of their items are available to programs. That's great!

I don't think dev mode is a good place to hide things you think are too cognitivy. That's what libraries are for, although we should try to avoid having a bunch of one-block libraries that could maybe be combined. (I'm allowed to say "we should" because I'm part of the "we," especially with respect to libraries.)

Dev mode, imho, is for things that aren't finished yet, and for things really of interest only to developers or to users who want to be developers, such as PROCESSES and the other census-ish ones in Sensing. Putting something in dev mode attaches a hidden "you'll be sorry" to it. Is that the case with SAVE AS COSTUME? Is it not finished yet? (Not rhetorical questions; I really want to know.)

That is very helpful when I make libraries.

Except now you can put variables in libraries. All you need to do is put the variable in a block, and then the variable will be exported in the xml.

Really?

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.