
Pg-Basic - sillysaurusx
https://repl.it/@paulgraham/repeat
======
capocannoniere
PG tweet for context:
[https://twitter.com/paulg/status/1256526589300441093](https://twitter.com/paulg/status/1256526589300441093)

> I wrote this yesterday as an example for my kids.

> A lot of people learned how to make web pages using view->source. Replit is
> view->source for code, plus a server you can run a copy on. A generation of
> kids will learn to program from it.

~~~
rckoepke
> A generation of kids will learn to program from it.

Undergraduates at mid-tier schools are already using it nearly exclusively for
their lower-level coursework. And mainly by word-of-mouth. While I've seen all
the students using it to essentially do code reviews, I haven't seen any
professors mention it to their classes.

~~~
amasad
That's awesome -- how did you find that out?

~~~
rckoepke
Not an exhaustive survey by any means, but I'm currently getting my second
bachelors, in computer science from a city university. We have some Discord
servers with CS students from a variety of schools, and repl.it seems to be a
primary resource for everyone. You may be able to get more reliable statistics
by determining location of users with repl's named "HW", "Assignment",
"Lecture", "Exam", or common course prefixes like COSC, CSE, etc. ('CS', and
'Quiz' might not be as reliable for isolating academics).

It would be useful to have private repl's for students, as it's a technically
a looming academic integrity issue to have most student's repl's public[0]. I
understand this is potentially a breaking change for your freemium model, but
there's a bit of a time bomb waiting there. Whether it's a tempest in a teapot
or a "real" problem, and for whom, is debatable.

For my coursework, all C++ code must be complied with a .replit file
containing:

> run = "g++ main.cpp -Wall -Wextra -std=c++11 -o a.out && ./a.out"

> language = "c++"

This is because everything is "turned in" on ZyBooks, which uses these
options.

It's very, very cool that you let us change the compiler+options using either
a .replit file or directly compile and run from the repl.run command line.
However, most of my peers never discovered that the repl.run command line was
interactive -- and certainly didn't find the .replit file feature. As a
result, some moved away from repl.it mid-semester (generally migrating
permanently to CLion) because clang "fixes" too many errors for them and
things would "work" on repl.it but not on ZyBooks where it matters. For this
reason I think there's potentially some use in putting a compiler/compile
option inside each repl's side navbar's setting button menu. If this doesn't
seem appropriate (for example because repl's in many language don't need to
change compiler/options), then I'd recommend at least putting a link there to
an explanation on .replit files for better discoverability.

Speaking of ZyBooks, I think the Repl.it company could compete well in the
educational space. In particular, I think OpenStax would be a good
organization to get in touch with, depending on how it fits your financial
model / philosophy. Most broadly though I find there is an incredible lack of
rigorous application of the _science of teaching_ in online learning
solutions, dating back to Khan Academy and affecting every online learning
platform since. Here's an example of what I'm talking about [1]. The linked
video is somewhat long/boring and very low production quality --- but I hope
the concepts in the content stick with anyone who works in edu-tech. I'm often
very surprised that given the budgets of companies like Khan Academy, Udacity,
etc that I don't see strong evidence they used a small portion of the money to
consult with an expert who specializes in techniques and science of teaching.

Lastly, (at least as of 8 weeks ago) when the repl.run console is broken out
into a separate window (great for multi-monitor displays!), it did not display
segfault error messages in the break-out console. This happens with any red-
colored text in the repl.run window - it displays in the primary editing
window's console, but does not display in the broken out standalone repl.run
console window. It was very difficult to determine why my code wasn't
outputting anything after a certain point, but also was not throwing any
errors :)

For example:

int main(void)

{

    
    
        main();
    
        return 0;
    

}

Case A: Using g++ via .replit in main window (same .replit file as shown above
in this post) ('exit status 139' is printed in red):

> g++ main.cpp -Wall -Wextra -std=c++11 -o a.out && ./a.out

Segmentation fault (core dumped)

exit status 139

>

Case B: Same setup as Case A, but reviewing output shown in the repl.run
break-out tab/window: (there is no red 'exit status 139' output)

> Segmentation fault (core dumped)

Case C: Using g++ directly in repl.run console in main window (also no 'exit
status 139'):

> g++ main.cpp -Wall -Wextra -std=c++11 -o a.out && ./a.out

Segmentation fault (core dumped)

>

Case D: Using clang in main window ('exited, segmentation fault' appears in
red text):

> clang++-7 -pthread -std=c++17 -o main main.cpp

> ./main

exited, segmentation fault

>

Case E: Using clang in repl.run breakout tab/window ('exited, segmentation
fault' does not appear at all, in fact nothing appears):

>

Lastly, I'm sure this is asking for the moon, but eventually it would be
incredible to have debugging tools in the development environment (step
through, current values of variables, and maybe memory inspection) - this
applies to nearly every language you currently support. More specifically to
C++, some people may also enjoy having features similar to those found at
[https://godbolt.org/](https://godbolt.org/) although I'd imagine that's a
very niche group of people at the moment. You're serving a very wide audience
as it is.

My classmates are extremely impressed with the quality of repl.it - the deep
feature set does not seem to have compromised usability at all. My classmates
are also very impressed with your 'careers' page, I would keep that up for
engineering roles as you grow, if not necessarily also for non-technical
administrative roles.

0:
[https://www.google.com/search?q=site%3Arepl.it+COSC](https://www.google.com/search?q=site%3Arepl.it+COSC)

1:
[https://www.youtube.com/watch?time_continue=15&v=hC0MV843_Ng...](https://www.youtube.com/watch?time_continue=15&v=hC0MV843_Ng&feature=emb_logo)

------
amasad
Cool see this here! But let me provide some context: This is a program PG
wrote with his kid. He asked me to build into Repl.it a classic Basic
implementation and make it really easy to do graphics programming. So I wrote
an interpreter and called it pg-basic

Try it here: [https://repl.it/l/basic](https://repl.it/l/basic)

Docs: [https://docs.repl.it/misc/basic](https://docs.repl.it/misc/basic)

Interpreter source code: [https://repl.it/@amasad/pg-
basic](https://repl.it/@amasad/pg-basic)

PG's tweet:
[https://twitter.com/paulg/status/1256526589300441093](https://twitter.com/paulg/status/1256526589300441093)

However, we realized that we can do a much better job on syntax and other
features. So in collaboration with PG, we're evolving the language to make it
more expressive and cleaner without losing the magic that makes Basic a great
introductory programming language.

~~~
parhamn
Thats awesome! Have you ever written a blog post or anything about the how
repl.it works? Its not typically a JS reimplementation right? I always assumed
a container/nsjail.

~~~
amasad
Yes so regardless of what language or where the language runs, we give you a
container, inside that container we drop in a server that's responsible for
most of the functionality including editing, collaboration, hosting, etc. A
little about that here:
[https://blog.repl.it/collab](https://blog.repl.it/collab)

The IDE is built on top of a window-tiling manager abstraction we built in
React.js: [https://blog.repl.it/ide](https://blog.repl.it/ide)

Now, as for languages, most of them do run inside the container, which is
built from our base image polygott
([https://github.com/replit/polygott](https://github.com/replit/polygott)).
However, a select-few are better suited to run on the client. We have a
client-side jail called: replbox
([https://github.com/replit/replbox](https://github.com/replit/replbox)).
Basic, for example, runs on replbox because I wanted to graphics to be
instant. For something like PyGame or LOVE frameworks we had to go with VNC
streaming but that's not ideal for obvious network reasons.

There is a lot more to it -- it sometimes feels like building an entire city
-- and you can find some more posts on our blog:
[https://blog.repl.it/](https://blog.repl.it/) (which incidentally is hosted
on Repl.it).

~~~
jpereira
Any update on open sourcing that window tiling abstraction in React? Sounds
very useful!

~~~
amasad
We've made progress but remain not entirely satisfied with its API. This is a
big focus for us now and hope to have something to announce soon.

------
jedberg
When I was a kid, I thought one of the coolest things in the world was that
when I turned the PC on, it dropped into a programming environment if you
didn't put a disk in the A: drive.

I felt like my kids would miss out on this experience of random programming.

repl.it is a nice substitute though. Maybe I'll just pull out an old computer
and force it to boot into repl.it...

~~~
mysterydip
If you have a spare raspberry pi laying around, give dosbian a try. A custom
raspbian that drops to a fullscreen dosbox in seconds. Drop qbasic on there
and some example code from the sites out there, and let them have at it.

------
harel
This is actually a little bit emotional to see line numbers, gosubs and gotos.
Throws me back to wee old me in the 80s, hacking along on my VIC 20 before I
even had a grasp of English.

------
jshaqaw
Very cool. For all it’s age and warts there is nothing like Basic for a kid to
start textual coding.

~~~
DanBC
Yes!

I think this is a great step between Scratch and something like Python.

------
beagle3
This is awesome and cool. Related (from 20 days ago):
[https://news.ycombinator.com/item?id=22841336](https://news.ycombinator.com/item?id=22841336)
\- a similar setup, not inside repl.it

~~~
amasad
I just made line numbers optional and it kinda starts looking like EasyLang. I
think they also started from Basic.

------
canada_dry
+1 Kudos for providing the repl.it tool.

The classroom/assignment feature [i] is absolutely brilliant! Also, now might
be a great time to do another [ii] hackathon.

[i]
[https://docs.repl.it/classrooms/intro](https://docs.repl.it/classrooms/intro)

[ii]
[https://repl.it/talk/announcements/Massively_Multiplayer_Hac...](https://repl.it/talk/announcements/Massively_Multiplayer_Hackathon/22788)

------
dmux
Does this not work in Firefox? Upon running the code I get the prompt and a
blank grid drawn, but no colors or anything to indicate what's being drawn.

~~~
gabrielsroka
It works for me (Firefox latest on Windows or Ubuntu).

Did you click Run?

------
mdonahoe
Line numbers are awful, but other than that I think basic is a great first
language. I loved learning how to make games for myself in Qbasic

------
gabrielsroka

      10 cls
      20 print chr(2 + rnd(2) * 45);
      40 goto 20
    

[https://repl.it/@gabrielsroka/amazing](https://repl.it/@gabrielsroka/amazing)

------
stormdennis
I initially thought this was something to do with postgres, like for writing
stored procedures or something.

------
russfink
Can I host my own repl.it ssrver? Sorry for off-topic but I cannot find an
answer either way. Thanks.

~~~
lioeters
I'm curious about this as well. From what I can see, all the components are
open-source.

Documentation - [https://docs.repl.it/](https://docs.repl.it/)

Repl.it evaluation server -
[https://github.com/replit/polygott](https://github.com/replit/polygott)

Universal interpreter for REPL -
[https://github.com/replit/prybar](https://github.com/replit/prybar)

Client-side protocol -
[https://github.com/replit/crosis](https://github.com/replit/crosis)

Evaluation sandbox -
[https://github.com/replit/replbox](https://github.com/replit/replbox)

------
perlpimp
Am I only one thought of pg-basic for stored procedures in stored procedures?

~~~
chungy
I expected something about PostgreSQL too.

