This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#6626 2013-01-23 06:48:19

Jens
Scratcher
Registered: 2007-06-04
Posts: 1000+

Re: BYOB 3 - Discussion Thread

My mantra is:

   "Flush your browser's cache!"  smile

You'll see the "export..." feature if and as soon as there is something "texty" assigned to the variable, either a text or a number. I think being able to import "raw" data is the most generic and gives you the most possibilites, rather than automatically converting lines to list items, which you can easily do yourself in Snap! by creating your own PARSE block (it's in the OPERATOR's category)

Last edited by Jens (2013-01-23 06:51:26)


Jens Mönig

Offline

 

#6627 2013-01-23 08:39:20

Hardmath123
Scratcher
Registered: 2010-02-19
Posts: 1000+

Re: BYOB 3 - Discussion Thread

I got a nice little Python server going; so now I can export lists to a file!  big_smile


Hardmaths-MacBook-Pro:~ Hardmath$ sudo make $(whoami) a sandwich

Offline

 

#6628 2013-01-23 08:41:11

Hardmath123
Scratcher
Registered: 2010-02-19
Posts: 1000+

Re: BYOB 3 - Discussion Thread

Random request: an operator block that returns the newline character. Alternatively, a dropdown with many constants like pi, e, space and newline.


Hardmaths-MacBook-Pro:~ Hardmath$ sudo make $(whoami) a sandwich

Offline

 

#6629 2013-01-23 09:03:21

blob8108
Scratcher
Registered: 2007-06-25
Posts: 1000+

Re: BYOB 3 - Discussion Thread

Jens wrote:

You'll see the "export..." feature if and as soon as there is something "texty" assigned to the variable, either a text or a number.

Is there any way to include newlines? Neither (unicode (10) as letter) nor (unicode (13) as letter) seem to work...

EDIT: Ah, I see Hardmath beat me to it  tongue

Last edited by blob8108 (2013-01-23 09:04:08)


Things I've made: kurt | scratchblocks2 | this cake

Offline

 

#6630 2013-01-23 09:26:29

Jens
Scratcher
Registered: 2007-06-04
Posts: 1000+

Re: BYOB 3 - Discussion Thread

Ah, I forgot to encodeURIComponent() the exported text, that's why you're loosing the CR's and LF's. That'll be fixed in the next release either later today or early tomorrow.


Jens Mönig

Offline

 

#6631 2013-01-23 11:45:04

bharvey
Scratcher
Registered: 2008-08-10
Posts: 1000+

Re: BYOB 3 - Discussion Thread

Jens wrote:

Yes, this is clearly The Right Thing.

That's not so clear to me.  It's clearly The Scratch Thing but Scratch was limited by not wanting to allow reading or writing files under program control.  We are limited by Javascript not wanting to allow that, but in other such cases we've decided to wait until browsers implement the official HTML5 way to do it.  The right thing, it seems to me, would be to have blocks OPEN FILE, READ LINE FROM FILE, WRITE LINE TO FILE, etc.  (Not just a CONTENTS OF FILE reporter, even though that would be in some ways more elegant, because some files are very very big.)

Only that in Snap we're using generic variable watchers for lists, so we want to import plain text files directly into a variable's value, and do the parsing ourselves.

I don't see how the conclusion follows from the premise.  In Scratch, you can't set the value of a variable to a list, so they have to have their kludge operate on Make-a-list lists, which we don't have.  But we could set the value of the user's variable to a list, one item per line.

Also, using a browser tab as an intermediary between the file and the Snap! project works only for text files.  If the file is HTML, or a JPG, or something, the browser will insist on interpreting the file's contents.  So if I'm trying to write a program that, I don't know, datestamps all the pictures in a certain folder, I can't do it this way.

Sorry, I know you don't like arguing about design in the forum, but you sprang this on me.

EDIT:  CONTENTS OF FILE would be fine if we had lazy lists, but they're hard to reconcile with a visual language.  After 4.0 is out we can talk about whether that's feasible.  I think it would be pedagogically awesome.

EDIT 2:  ... and because we can create lists dynamically, there's no reason (unlike the case in Scratch) why the contents of a file have to be associated with a variable, let alone a global one.  First class files!

Last edited by bharvey (2013-01-23 18:29:55)


http://cs.berkeley.edu/~bh/sig5.png

Offline

 

#6632 2013-01-23 11:50:08

bharvey
Scratcher
Registered: 2008-08-10
Posts: 1000+

Re: BYOB 3 - Discussion Thread

nXIII wrote:

@bharvey your ring has quite a following  tongue

I wonder Y?


http://cs.berkeley.edu/~bh/sig5.png

Offline

 

#6633 2013-01-23 14:29:27

nXIII
Community Moderator
Registered: 2009-04-21
Posts: 1000+

Re: BYOB 3 - Discussion Thread

bharvey wrote:

nXIII wrote:

@bharvey your ring has quite a following  tongue

I wonder Y?

tongue

Sorry, I know you don't like arguing about design in the forum, but you sprang this on me.

Why? I much prefer it to having to guess about your reasoning behind the design because you decide on it in private email messages.

As for importing stuff, how about exporting all values as XML? It's consistent with the project format, requires very minimal work on the client, and produces human-readable data. We could also offer an "import plain text" option for users who have data in other formats that they want to import and parse themselves.

Last edited by nXIII (2013-01-23 14:32:29)


nXIII

Offline

 

#6634 2013-01-23 15:40:06

joefarebrother
Scratcher
Registered: 2011-04-08
Posts: 1000+

Re: BYOB 3 - Discussion Thread

When we get file I/O, we should have a reporter, OPEN FILE () FOR [ v], that reports a stream (the dropdown having input, output, and both), then READ [ v] FROM () where the dropdown would have character, number, line, and all (and possibly s-expression). Also PEEK CHAR FROM (), and STREAM () AT EOF then for output, just WRITE () TO ()  that would accept a number or a string and write it. There could also be a block for writing lists as s-expressions. There would also be two constants, STANDARD INPUT and STANDARD OUTPUT (ore possibly a single constant that can be read to and written from. There could also possibly be socket streams too, for connection to/implementation of servers.

Finally, there could also be MAKE CUSTOM STREAM INPUT () OUTPUT () EOF PREDICATE () which takes 3 inputs: an procedure that takes no inputs and reports a character for input, a procedure that takes one input and writes it for output reporting nothing, and a predicate that takes no inputs and returns true or false depending on whether the stream as at the eof or not. All of these inputs can also be the empty ring to indicate "this feature is not supported." This could be used for implementing string-streams, pipes, and stream plumbing.


My latest project is called http://tinyurl.com/d2m8hne! It has http://tinyurl.com/d395ygk views, http://tinyurl.com/cnasmt7 love-its, and http://tinyurl.com/bwjy8xs comments.
http://tinyurl.com/756anbk   http://tinyurl.com/iplaychess

Offline

 

#6635 2013-01-23 18:07:34

bharvey
Scratcher
Registered: 2008-08-10
Posts: 1000+

Re: BYOB 3 - Discussion Thread

nXIII wrote:

Why? I much prefer it to having to guess about your reasoning behind the design because you decide on it in private email messages.

I don't know what Jens's reasons are, but one of mine is that you guys are a very atypical set of users.  We're trying to design for, you know, the kids who stuff you guys in lockers and/or wastebaskets.  (This is partly a joke, employing an exaggerated stereotype -- two of them, I guess -- to paint a quick picture, just so nobody feels the need to yell at me; in particular, our target audience includes girls, who for the most part are neither stuffers nor stuffees.  My serious point is that our target audience is non-programmer, non-mathematicians.)  So the things you want aren't necessarily the right choices.

Also, I think I spend a lot of time in this group explaining why we did various things the way we chose to do them.  But we can't explain the design until we understand it ourselves, and the beginning stages of a discussion sometimes involve more heat than light, a process we couldn't engage in so freely in public.

Just for example, when we first started talking about OOP, I think I was the only one in our gang with any real experience (from Object Logo) working with prototyping OOP.  The rest of you all grew up with Java and/or Smalltalk.  And I had the huge advantage of having hung out with Henry Lieberman back in the day.  So I knew I was right (no smiley, sorry, I really did) but had to convince Jens, and somehow we ended up having the argument in front of y'all, which made it kind of unpleasant.  (It would have been extra bad if I'd convinced everyone else before convincing Jens.  Luckily we were having an email conversation in parallel with the forum one.)

We definitely sometimes get great ideas from you that we might not otherwise have thought of.  But even in the real world, large design groups tend to lead to creeping featurism, so in the end you have a language nobody can learn even though each individual feature is fantastic.  (This is what's happened to Scheme recently, alas!)

P.S.  Yeah, B.A.A., I know I haven't convinced you yet.  smile

P.P.S.  And I also know that some of the details of the OOP design were too confusing, although I think including the tool blocks (in particular, TELL and ASK) in the reference manual will help a lot.

P.P.P.S.   ...but we're not going to have a public discussion about OOP until Jens and I have at least a detailed proposal and preferably a working version to present!

Last edited by bharvey (2013-01-23 18:23:29)


http://cs.berkeley.edu/~bh/sig5.png

Offline

 

#6636 2013-01-23 19:41:47

nXIII
Community Moderator
Registered: 2009-04-21
Posts: 1000+

Re: BYOB 3 - Discussion Thread

I see your points, but I'd still like to be able to see the discussions, even if I weren't an active participant in them. They're interesting.  smile

P.S. What does B.A.A. stand for?

P.P.S. I had actually been working with JS prototype OOP for a while when you introduced it into BYOB3.

Last edited by nXIII (2013-01-23 19:42:01)


nXIII

Offline

 

#6637 2013-01-23 20:18:25

Hardmath123
Scratcher
Registered: 2010-02-19
Posts: 1000+

Re: BYOB 3 - Discussion Thread

blob8108 wrote:

Jens wrote:

You'll see the "export..." feature if and as soon as there is something "texty" assigned to the variable, either a text or a number.

Is there any way to include newlines? Neither (unicode (10) as letter) nor (unicode (13) as letter) seem to work...

EDIT: Ah, I see Hardmath beat me to it  tongue

Woah, that was awesome. But my suggestion was more generic; I wanted to be able to have newlines in every string, including variables and say bubbles.  smile


Hardmaths-MacBook-Pro:~ Hardmath$ sudo make $(whoami) a sandwich

Offline

 

#6638 2013-01-23 20:23:27

nXIII
Community Moderator
Registered: 2009-04-21
Posts: 1000+

Re: BYOB 3 - Discussion Thread

Hardmath123 wrote:

blob8108 wrote:

Jens wrote:

You'll see the "export..." feature if and as soon as there is something "texty" assigned to the variable, either a text or a number.

Is there any way to include newlines? Neither (unicode (10) as letter) nor (unicode (13) as letter) seem to work...

EDIT: Ah, I see Hardmath beat me to it  tongue

Woah, that was awesome. But my suggestion was more generic; I wanted to be able to have newlines in every string, including variables and say bubbles.  smile

<unicode (13) as letter> works perfectly (try <<unicode (13) as letter> = ()>—it evaluates to false). The problem lies with Squeak Morphic's (and thus Morphic.js') strange insistence that "String" morphs are different from "Text" morphs—while one allows text wrapping and line breaks, the other does not wrap text and folds line breaks to whitespace.

EDIT: Augh.

Last edited by nXIII (2013-01-24 15:30:42)


nXIII

Offline

 

#6639 2013-01-24 08:15:55

Hardmath123
Scratcher
Registered: 2010-02-19
Posts: 1000+

Re: BYOB 3 - Discussion Thread

Oh. I suppose list watchers should be Text, then?

@bharvey: That's a pretty ambitious goal. All the (pardon me) non-intellectual kids who are mainly soccer players seem to be pretty averse to anything involving numbers, or, for that matter, thinking. And for them learning to code in school (Visual Basic *utter disgust smiley here*) is basically no better than history class.  hmm  I suppose I was really lucky; I was introduced to computers out of my own sweet will, and everything I learned, I learned on my own because I wanted to. That makes a difference.


Hardmaths-MacBook-Pro:~ Hardmath$ sudo make $(whoami) a sandwich

Offline

 

#6640 2013-01-24 14:42:13

bharvey
Scratcher
Registered: 2008-08-10
Posts: 1000+

Re: BYOB 3 - Discussion Thread

Hardmath123 wrote:

That's a pretty ambitious goal. All the (pardon me) non-intellectual kids who are mainly soccer players seem to be pretty averse to anything involving numbers, or, for that matter, thinking.

It's a hugely ambitious goal.  But right now all the job growth is in low-paid personal service jobs and in programming-related jobs.  And, luckily, programming is fun!  (As long as you don't hide it behind Java-like syntax.)  Check out this sports jock saved by Snap! and BJC.

Programming is great for kids precisely because it's mathematical without having anything much to do with numbers.  And certainly you don't have to do any arithmetic yourself -- you can get the computer to do it!


http://cs.berkeley.edu/~bh/sig5.png

Offline

 

#6641 2013-01-24 15:37:47

nXIII
Community Moderator
Registered: 2009-04-21
Posts: 1000+

Re: BYOB 3 - Discussion Thread

Hardmath123 wrote:

Oh. I suppose list watchers should be Text, then?

Everything should be a TextMorph, and StringMorphs shouldn't exist at all.

Last edited by nXIII (2013-01-24 15:41:41)


nXIII

Offline

 

#6642 2013-01-24 23:49:50

BornAgainAtheist
New Scratcher
Registered: 2012-02-13
Posts: 42

Re: BYOB 3 - Discussion Thread

bharvey wrote:

And, luckily, programming is fun!  (As long as you don't hide it behind Java-like syntax.)

I don't really mind Java like syntax, of course that may just be because Eclipse and Visual Studio make me lazy. Though no language has ever come as close to my heart as Snap/BYOB; mostly because of the custom c-shaped blocks.

Offline

 

#6643 2013-01-25 05:42:10

blob8108
Scratcher
Registered: 2007-06-25
Posts: 1000+

Re: BYOB 3 - Discussion Thread

BornAgainAtheist wrote:

I don't really mind Java like syntax, of course that may just be because Eclipse and Visual Studio make me lazy.

I get the feeling that any language that needs an editor like Eclipse to be productive has failed somehow.  tongue


Things I've made: kurt | scratchblocks2 | this cake

Offline

 

#6644 2013-01-25 09:56:20

Hardmath123
Scratcher
Registered: 2010-02-19
Posts: 1000+

Re: BYOB 3 - Discussion Thread

+1 That's why the whole world should run on...
...you guessed it...
Python!

tongue

Speaking of languages, bharvey, how tough would it be to implement a programming language from scratch (not Scratch; take the figurative meaning this time)? I was thinking of writing a cross between Lisp and Python, two of the coolest languages ever. The idea is to combine the (lack of!) syntax of Lisp with the efficiency of Python, and I already have a few syntax elements in my mind.

I'm planning on writing the compiler in Python, and you should be able to run it a standalone executable on the command line. But the cool bit is that I want to write a JS-based interpreter, too, so you can do something like this:

Code:

<script type="text/javascript" src="interpreter.js"></script>
<script type="application/*my language's name*" src="path"></script>

which fetches a JSON-compiled version of the script (maybe it can be linked with Morphic!).


Hardmaths-MacBook-Pro:~ Hardmath$ sudo make $(whoami) a sandwich

Offline

 

#6645 2013-01-25 11:41:35

blob8108
Scratcher
Registered: 2007-06-25
Posts: 1000+

Re: BYOB 3 - Discussion Thread

Hardmath123 wrote:

a cross between Lisp and Python

Called Lyspthon, obviously.  tongue


Things I've made: kurt | scratchblocks2 | this cake

Offline

 

#6646 2013-01-25 12:00:34

nXIII
Community Moderator
Registered: 2009-04-21
Posts: 1000+

Re: BYOB 3 - Discussion Thread

Hardmath123 wrote:

Speaking of languages, bharvey, how tough would it be to implement a programming language from scratch (not Scratch; take the figurative meaning this time)?

It varies depending on the library/environment in which you choose to work. It's not terribly difficult, though. Just make sure to spend a lot of time designing the language and specifying behavior before you implement a parser/compiler/interpreter, and make sure your parser/compiler/interpreter conforms to that specification.

I was thinking of writing a cross between Lisp and Python, two of the coolest languages ever.

That does sound cool, but aren't they sort of opposite paradigm-wise?

maybe it can be linked with Morphic!

That will kill performance instantly.

Last edited by nXIII (2013-01-25 12:01:04)


nXIII

Offline

 

#6647 2013-01-25 12:44:20

Jens
Scratcher
Registered: 2007-06-04
Posts: 1000+

Re: BYOB 3 - Discussion Thread

Jeez, nXIII.
(the Pope is more broad-minded).  smile


Jens Mönig

Offline

 

#6648 2013-01-25 13:43:37

bharvey
Scratcher
Registered: 2008-08-10
Posts: 1000+

Re: BYOB 3 - Discussion Thread

nXIII wrote:

P.S. What does B.A.A. stand for?

Have you figured this out yet?   smile


http://cs.berkeley.edu/~bh/sig5.png

Offline

 

#6649 2013-01-25 14:11:39

bharvey
Scratcher
Registered: 2008-08-10
Posts: 1000+

Re: BYOB 3 - Discussion Thread

Hardmath123 wrote:

how tough would it be to implement a programming language from scratch?

It's not very hard to write a toy implementation of a language (especially if the language is Lisp, which has no syntax to worry about).  It's a lot harder to write a really efficient implementation.  Garbage collection alone is an ongoing research topic and not easy to get right.  (Multiprocessor GC boggles the mind.)

Even though a lot of people use it, I'd put Berkeley Logo in the "toy" category, partly because its GC is rather primitive, and partly because of issues with tail call elimination.  (Scratch, BYOB, and Snap! all benefit from being implemented on top of languages that provide garbage collection.  But an interpreter on top of an interpreter has its own efficiency problems.)

I was thinking of writing a cross between Lisp and Python, two of the coolest languages ever. The idea is to combine the (lack of!) syntax of Lisp with the efficiency of Python, and I already have a few syntax elements in my mind.

If that's meant to suggest that Lisp is inefficient, you should do timing runs of compiled Common Lisp against Python.

For teaching purposes, we Lispians encourage beginners not to worry about efficiency in a first course, and that means things like encouraging simpler (non-tail-)recursive procedures over more complicated iterative ones with extra state variables thrown in.  But professional Lisp programmers can write iterative code where it matters.

If the object of the exercise is for you to learn about programming language design and implementation, go for it!  But if you truly expect any "a cross between" language to end up better than its parents, history is against you.  The languages that go down in history have a simple organizing idea around which the language is structured.  C is a more important language than C++ because the former is organized around bringing the notation of a high level language to a semantic model that makes explicit the placement of data in memory, whereas the latter is a cross between C and Smalltalk.  Lisp is organized around functions and linked lists.  I'm not a big Python fan partly because it seems to have three different implementations of the Sequence abstraction (although of course also because it has a broken lambda).


http://cs.berkeley.edu/~bh/sig5.png

Offline

 

#6650 2013-01-25 14:13:11

bharvey
Scratcher
Registered: 2008-08-10
Posts: 1000+

Re: BYOB 3 - Discussion Thread

Jens wrote:

(the Pope is more broad-minded).

Ooh, Jens is going to get yelled at by a Community Moderator!  (Usually that's my role.)  smile


http://cs.berkeley.edu/~bh/sig5.png

Offline

 

Board footer