ELLIOTTCABLE changed the topic of #elliottcable to: #ELLIOTTCABLE — “do something cool, shove it into throats, everyone thinks it's crap, then it's all amazing.” “everything else is just details.”
<yorick> actually the lack of asi on lines that start with (
<yorick> in this case because it's not a syntax error
<ELLIOTTCABLE> mmhmm
<ELLIOTTCABLE> nicoou: yorick nailed it, and I have to bow to him, because I *should* have known better.
<ELLIOTTCABLE> nicoou: you have to type exactly `;(EXPRESSION)`, with the semicolon.
<ELLIOTTCABLE> weird, I know. But that's one of the more arcane JavaScript whidjetifiers.
<nicoou> ah
<ELLIOTTCABLE> so, try exactly what you typed earlier, with that as well. (=
<nicoou> so it'd have to be `;(person)` ?
<nicoou> or the whole bit
<ELLIOTTCABLE> || var person = { name: "Elliott Cable", age: 21 + 3 }
<ELLIOTTCABLE> >> ;(person)
<purr> ELLIOTTCABLE: {age: 24, name: 'Elliott Cable'}
<nicoou> ah
<ELLIOTTCABLE> man, why're you suddenly listening to me again, purr ;_;
<ELLIOTTCABLE> such an unreliable little bitch.
<ELLIOTTCABLE> anyway.
<nicoou> hahaha
<ELLIOTTCABLE> so! we've gotten kinda side-tracked here. but! we've covered a lot!
<ELLIOTTCABLE> let's talk about a couple more operators.
<nicoou> i've seriously learned more than i did over a whole term of school
<ELLIOTTCABLE> they all work in pretty much the same way: put an expression on either side of them.
<nicoou> okay
<ELLIOTTCABLE> + - / *
<ELLIOTTCABLE> all do what they sound like they would do, for the most part. (there's a lot of caveats here, having to do with that fact that i mentioned earlier … that JavaScript has *only one* kind of number … which means some of these do strange things, in edge-cases … but you'll be fine for 42 + 3*3, and such.)
<ELLIOTTCABLE> in addition, + works on *strings*, as well, meaning you can add two strings together, which makes the computer create a new string that has all their words mashed up together.
<ELLIOTTCABLE> >> "Nicole" + "Chavda"
<purr> ELLIOTTCABLE: 'NicoleChavda'
<nicoou> dfjsghdflkjghdflg;
<ELLIOTTCABLE> notice, it doesn't magically add anything that *wasn't* already in the strings, even if it would make sense. Rather obviously, for instance, there's no space between the words.
<nicoou> ELLIOTT
<ELLIOTTCABLE> BROWN LITTLE SHITES
<ELLIOTTCABLE> DOZENS OF THEM
<ELLIOTTCABLE> er sorry what anyway,
<nicoou> YOURE A LITTLE SHIT
<nicoou> go on though haha
<ELLIOTTCABLE> those keywords are what we call “operators.”
<ELLIOTTCABLE> this rule sounds a little arcane, but it's worth remembering: an ‘operator’ is a bit of syntax, that *goes with an expression*
<ELLIOTTCABLE> (or more than one expression)
<ELLIOTTCABLE> since ` + ` goes with two expressions on either side, it's an ‘operator.’
<ELLIOTTCABLE> that is, it operates, on the values of those expressions.
<nicoou> makes sense
* ELLIOTTCABLE nods
<ELLIOTTCABLE> there's other operators, that only have a *single* expression in them.
<ELLIOTTCABLE> for instance, `!` (yes, that's an exclamation point.
<ELLIOTTCABLE> it works like this: `! <expression>`
<ELLIOTTCABLE> crap! I haven't explained booleans yet!
<nicoou> :O
<nicoou> ive heard that word before
<ELLIOTTCABLE> well, ! turns true into false … and false into true. it inverts truth/falsehood. If you know what the logical operators are (AND, NOT, OR … the kind of stuff you can type into Gmail or Google), it means the NOT operator.
<ELLIOTTCABLE> if that was all greek to you, don't worry.
<ELLIOTTCABLE> let's cover booleans real quick. (=
<nicoou> no that kinda made sense :)
<ELLIOTTCABLE> a boolean is another “type” of data. Just like numerics are a type of data, that represents real-numbers,
<ELLIOTTCABLE> and strings are a type of data that represents English (and sometimes other) characters, strung together into words or sentences
<ELLIOTTCABLE> booleans are a type of data, and they represent truth and falsehood.
<nicoou> okay
<ELLIOTTCABLE> there's a near infinitude of possible numerics (1895, 42.2, 0.000001, 23e-172 …),
<ELLIOTTCABLE> and an even larger set of possible strings,
<ELLIOTTCABLE> but there's exactly two possible booleans values.
<ELLIOTTCABLE> `true`, and `false`.
<nicoou> easy
<ELLIOTTCABLE> both are keywords, meaning you can't use them as variable names, or change them, or anything.
<ELLIOTTCABLE> and both are also expressions, meaning you can use them anywhere you could use a variable name.
<ELLIOTTCABLE> for instance,
<ELLIOTTCABLE> here, you do it.
<ELLIOTTCABLE> let's review again, and add this in:
<nicoou> wait wait
<ELLIOTTCABLE> make me a *new* object, describing yourself … but add a boolean to a slot on your nicole-object.
<ELLIOTTCABLE> a boolean conveying your marital status.
<nicoou> you can't use them as variable names, but you can use them in place of a variable?
<ELLIOTTCABLE> you can use them in the place of an *expression*.
<ELLIOTTCABLE> variable-labels are just one of the possible expressions.
<ELLIOTTCABLE> so, for example,
<ELLIOTTCABLE> `var <LABEL> = <EXPRESSION>`
<ELLIOTTCABLE> the <expression>, there, could be `a_variable_name` … or it could be `true`.
<ELLIOTTCABLE> make a little bit of sense?
<nicoou> ohhh okay
<nicoou> yes
* ELLIOTTCABLE nods
<nicoou> so
<ELLIOTTCABLE> remember, an expression is anything that has a value …
<ELLIOTTCABLE> and the word `true` has a value, of Truth™.
<ELLIOTTCABLE> so,
<ELLIOTTCABLE> `var has_nicole_had_prekeshs_babies_yet = false`
<nicoou> LOL
<purr> LOL
<ELLIOTTCABLE> means we're storing Falseness™ into a box.
<ELLIOTTCABLE> just like we could store a numeric,
<ELLIOTTCABLE> `var how_many_of_prekeshes_babies_has_nicole_had = 0`
<nicoou> so it doesnt need to be in quotations if its true/false?
<ELLIOTTCABLE> or a string,
<ELLIOTTCABLE> `var what_will_nicole_name_her_first_child = "Miniprekkies"`
<ELLIOTTCABLE> yep!
<nicoou> -_______-
Sgeo has joined #elliottcable
<nicoou> okay haha
<ELLIOTTCABLE> if you put it in quotations, it would be the word "true". that is, the english word, that sounds like ‘troooooooo.’
<ELLIOTTCABLE> outside of quotations, it means the platonic ideal of Truthness.
<ELLIOTTCABLE> values are *meanings*.
<nicoou> alright
<nicoou> i thought so
<ELLIOTTCABLE> `true` is another literal, by the way.
<nicoou> ok
<ELLIOTTCABLE> meaning it references, or creates, a particular object, every time you put it in your code.
<ELLIOTTCABLE> just like `42` creates, or references, the “concept of forty-two-ness”, inside the computer,
<ELLIOTTCABLE> `true` is a literal that references the concept-of-truth.
<ELLIOTTCABLE> m'kay.
<ELLIOTTCABLE> Yes, a bit confusing, but it'll clear up with a little more time.
<ELLIOTTCABLE> So!
<nicoou> makes sense somewhat
<ELLIOTTCABLE> operator, exclamation point: we call it NOT.
<ELLIOTTCABLE> if the value of the expression it's attached to is Truth, then the value of itself, will be False.
<ELLIOTTCABLE> and vice versa.
<nicoou> easy enough
<ELLIOTTCABLE> (remember, any operator, with expressions, are then *all together* a new expression.)
<ELLIOTTCABLE> so, using the vertical-bar example-text I was doing earlier,
<ELLIOTTCABLE> | !|has_nicole_had_prekeshs_babies_yet| |
<nicoou> means its false?
<nicoou> or true
<nicoou> because the var you made was false
<ELLIOTTCABLE> no, the value of that entire expression would be *true*. Because we're NOTing the value of the inner-expression.
<nicoou> yeah okay
<ELLIOTTCABLE> yeah. you got it, there at the end. (=
<nicoou> i realized haha
<nicoou> NO BABIES NO
<ELLIOTTCABLE> let's try this with the neat trick I showed earlier, for asking the bot to tell us about these things.
<ELLIOTTCABLE> || var does_nicole_want_babies = false
<ELLIOTTCABLE> >> ;( does_nicole_want_babies )
<purr> ELLIOTTCABLE: false
<ELLIOTTCABLE> okies, but if we …
<ELLIOTTCABLE> || var does_nicole_want_babies = false
<ELLIOTTCABLE> >> ;( ! does_nicole_want_babies )
<purr> ELLIOTTCABLE: true
<yorick> ;( ) just looks sad
<nicoou> i get ittttt
<ELLIOTTCABLE> there. the value of the expression *with* the exclamation point, is inverted.
<ELLIOTTCABLE> m'kay.
<ELLIOTTCABLE> those are all easy.
<ELLIOTTCABLE> now that we know about booleans, let's talk about some *more* cool operators.
<ELLIOTTCABLE> you've got + - * / !,
<ELLIOTTCABLE> and =, which is a special case,
<ELLIOTTCABLE> how about these: >=, <=, !==, ===
<ELLIOTTCABLE> (yes, there's an inconsistent number of equals-marks in some of those, and it could easily be very confusing. Also, programs do VERY BAD THINGS™ if you type the wrong number of equals-marks, without telling you. So you have to memorize those, and be extremely extremely careful about typing them.)
<ELLIOTTCABLE> they're called “comparison” operators.
<nicoou> okay
<ELLIOTTCABLE> each one has two expressions, one on each side, just like + or *
<ELLIOTTCABLE> … but instead of the evaluated result being another *number*,
<ELLIOTTCABLE> the evaluation will give you a *boolean*.
<ELLIOTTCABLE> truth, or falsehood.
<nicoou> okay
<ELLIOTTCABLE> for instance:
<ELLIOTTCABLE> || var does_nicole_have_more_babies_than_her_mother, nicole_babies, mother_babies
<ELLIOTTCABLE> || nicole_babies = 0, mother_babies = 3
<ELLIOTTCABLE> || does_nicole_have_more_babies_than_her_mother =
<ELLIOTTCABLE> || nicole_babies >= mother_babies
<ELLIOTTCABLE> || ;( does_nicole_have_more_babies_than_her_mother )
<ELLIOTTCABLE> >> ;( does_nicole_have_more_babies_than_her_mother )
<purr> ELLIOTTCABLE: false
<ELLIOTTCABLE> heh, messed up the last bit there.
<ELLIOTTCABLE> that's a lot of lines of code. do you understand it?
<nicoou> i think so
<ELLIOTTCABLE> there's a couple new things in there, and a couple things that we *did* talk about, but glossed over. let's review it.
<ELLIOTTCABLE> so, we're creating three boxes, that we're going to use in our program.
<ELLIOTTCABLE> two of them will store numerics, and one of them will store a boolean (the result of our question to the computer.)
<yorick> nah, "1" == 1, totally makes sense man.
<ELLIOTTCABLE> then we use the >= operator, which means greater-than-or-equal-to, to determine which variable is holding the bigger number.
<ELLIOTTCABLE> let's break that line down, for a moment.
<ELLIOTTCABLE> LINE: does_have = | |nicole_babies| >= |mother_babies| |
<ELLIOTTCABLE> (notice, that I didn't put the left-hand side into bars. That's because it's not an expression.)
<ELLIOTTCABLE> so there's three expressions there. First, the computer pulls values *out* of two variables for us,
<ELLIOTTCABLE> and then it hands those values over to the operator.
<ELLIOTTCABLE> the operator does something on those values its given, and then *it* has a result, which is the value of the entire expression we've composed, there.
<ELLIOTTCABLE> that result-value is ‘false’, which then gets stored into the box we made for the result.
<ELLIOTTCABLE> all explicitly clear, I hope
<ELLIOTTCABLE> yes?
<nicoou> okay
<nicoou> yes
<ELLIOTTCABLE> now, I'm going to mention one last *crucial* operator, and this one's a bit special. you'll need to follow along carefully.
<ELLIOTTCABLE> it looks like this:
<ELLIOTTCABLE> expression[ expression ]
<ELLIOTTCABLE> with the square-brackets, like that.
<nicoou> okay
<ELLIOTTCABLE> the part on the inside, is turned into a string (don't worry about that, for now; for now, we'll just *give* it strings, so that doesn't get confusing),
<ELLIOTTCABLE> then the part on the outside, the left, is evaluated (reduced to a value),
<ELLIOTTCABLE> and then that string is used to pick a *slot* on the left's value.
<ELLIOTTCABLE> remember those? from sticky-blob objects?
<ELLIOTTCABLE> :D
<nicoou> mhm
<ELLIOTTCABLE> so, like this:
<ELLIOTTCABLE> oh. important side-note. so sorry I missed this, it's just so trivial, that I forgot
<ELLIOTTCABLE> *any* expression can have parenthesis put around it. with no effect.
<ELLIOTTCABLE> however, if there's multiple expressions in a line, it can help to determine which expressions are evaluated *in what order*.
<nicoou> okay
<ELLIOTTCABLE> don't worry about that for now, we're just going to use them to show you where I'm using expressions.
<ELLIOTTCABLE> SO! :D
<ELLIOTTCABLE> remember your first Object, earlier?
<nicoou> yes
<ELLIOTTCABLE> { name: "Nicole", age: 20 }
<ELLIOTTCABLE> if we'd previously created an objet like that, and stored it in a variable labeled “person”,
<ELLIOTTCABLE> || var person
<ELLIOTTCABLE> || person = ( {name: "Nicole", age: 20} )
<ELLIOTTCABLE> then we can use that value as the *left* hand side of this operator.
<ELLIOTTCABLE> || (person) [ "name" ]
<ELLIOTTCABLE> >>
<ELLIOTTCABLE> that's a bit complex. Do you understand?
<nicoou> i think
<nicoou> kinda
<ELLIOTTCABLE> it's a lot like typing out the name of a variable,
<ELLIOTTCABLE> except it's what we call “dynamic.” That means, *as the line of code is being executed*, that expression will be evaluated into whatever value it may be at the time.
<nicoou> so if you were to input a new name value, then it would replace "Nicole" ?
<ELLIOTTCABLE> that just sounds complex for now, but it should give you an idea.
<ELLIOTTCABLE> yes.
<yorick> you should totally just use eval("person["+x+"]")
<nicoou> :D
<ELLIOTTCABLE> which brings us to the next bit:
<ELLIOTTCABLE> it's a special-case, and so it won't make a lot of sense in the framework of ‘expressions’ that I've been using to explain everything,
<ELLIOTTCABLE> but you can use *this operator*, on the *left*-hand side of an ` = `.
<nicoou> okay
<ELLIOTTCABLE> boom!
<ELLIOTTCABLE> with that, you can *change* the thing we've stuck to the object, for a particular slot, *after* having created it.
<ELLIOTTCABLE> and here's where we come back to our old shoes, for the second time.
<ELLIOTTCABLE> let's stop talking syntax, and computers, and have a quick visualization exercise as a refresher.
<ELLIOTTCABLE> (we call this thing, that we've just been doing, “assignment.” That's what ` = ` actually means.)
<nicoou> okay
<ELLIOTTCABLE> we've got our new shoes-thing in a box we created for them.
<ELLIOTTCABLE> now, we're going to take that shoes-thing out of 'my new shoes' box, and handle it …
<ELLIOTTCABLE> … and we're going to take that shoes-thing, and replace their laces with briiiiiight neon green ones.
<nicoou> oookay
<ELLIOTTCABLE> if we *had* a programming language that manipulated shoes, and laces, in a garage, that might look something like this:
<ELLIOTTCABLE> var neon_green_laces = <EXPRESSION TO CREATE LACES>
<ELLIOTTCABLE> shoes["laces"] = neon_green_laces
<ELLIOTTCABLE> (notice, that I didn't use `var shoes`. We created that a long time ago, and it still exists. You only have to create a box, once.)
<ELLIOTTCABLE> so.
<ELLIOTTCABLE> with that, back to the code-world.
<nicoou> okay
<ELLIOTTCABLE> time for you to put together some code, again.
<ELLIOTTCABLE> and this time, there's a new twist to the test:
<nicoou> oh jeez
<ELLIOTTCABLE> you're going to start with this line, unchanged:
<ELLIOTTCABLE> >> var years_since_middle_school = 3, person = { name: "Nicole", age: 15 }
<ELLIOTTCABLE> and then you're going to end with this line, unchanged:
<ELLIOTTCABLE> >> ;(person)
<purr> ELLIOTTCABLE: ReferenceError: person is not defined
<ELLIOTTCABLE> with that, you're going to *change* the person's age, to be her age *now*, instead of her age during middle school.
<ELLIOTTCABLE> you'll use an expression with the addition operator (` + `), and you'll use that assignment construct you just learned, to *replace* the value we've stuck into ‘age’ slot, with a new age-value you create.
<nicoou> oh man
<nicoou> hm
<nicoou> || var years_since_middle_school = 3, person = { name: "Nicole", age: 15 }
<nicoou> || age = 15+5
<nicoou> >> ;person[ "age" ]
<purr> nicoou: (number) 15
<nicoou> -_-
<ELLIOTTCABLE> you just stored the result of 15+5 into a new box.
<ELLIOTTCABLE> you didn't stick it to our Object.
<nicoou> oh!
<ELLIOTTCABLE> also, use the Object's *current* age, instead of the `15` literal; then add to that.
<nicoou> okay
<nicoou> now im confused oh god
* ELLIOTTCABLE nods
<ELLIOTTCABLE> that's entirely okay. (=
<ELLIOTTCABLE> when you type,
<ELLIOTTCABLE> `person = ...`
<ELLIOTTCABLE> you're storing a value, the result of the expression (...),
<ELLIOTTCABLE> into the variable named 'person'.
<ELLIOTTCABLE> that's a box, on our garage-wall, labeled 'person.
<ELLIOTTCABLE> when you do the same thing with 'age',
<ELLIOTTCABLE> you're still putting it in a box on the garage wall … just a *different* box, this one, labeled 'age', of course.
<ELLIOTTCABLE> at no point have you pulled the 'person' Object out of its box, and put something into a slot on that Object.
<ELLIOTTCABLE> then, on the very last line,
<ELLIOTTCABLE> you pull the Object out of the 'person' box and look in the slot, and Surprise! that slot hasn't chained.
<ELLIOTTCABLE> does that help? (=
<nicoou> kind of
* ELLIOTTCABLE nods
<ELLIOTTCABLE> so, the syntax, the stuff you type, to *replace* that slot on person, is:
<yorick> (if you're gonna make this #elliottcable_academy a regular thing I'd love to know about intermediate set theory like countability, well-ordered-ness, ZFC and continuum hypothesis)
<ELLIOTTCABLE> nah, nicoou gets special treatment 'cause she's hot.
<ELLIOTTCABLE> everybody knows the cute girls get the best stuff.
<ELLIOTTCABLE> @yorick
<nicoou> LOL what
<purr> LOL
<yorick> just pretend I'm a girl and hot
<ELLIOTTCABLE> ~~ so, the syntax, the stuff you type, to *replace* that slot on person, is:
<ELLIOTTCABLE> <EXPRESSION TO GET 'person' OUT OF BOX>['age'] = <EXPRESSION TO CREATE NEW AGE>
<incomprehensibly> ahhh irssi
<ELLIOTTCABLE> or,
<incomprehensibly> with low ping
<incomprehensibly> much faster than irccloud is besing for some reason
<ELLIOTTCABLE> (person)['age'] = (15+5)
<nicoou> ooh
<yorick> you could just teach nicoou about ZFC and then I'd listen :P
<nicoou> that's so easy
<incomprehensibly> coffeeee
<ELLIOTTCABLE> so, type it all out for me.
<ELLIOTTCABLE> remember, get the *previous* age, out of the Object. Don't type it in directly.
<ELLIOTTCABLE> incomprehensibly: +m'd, for #ELLIOTTCABLE_ACADEMY, as yorick puts it
<nicoou> ahaha
<nicoou> || var years_since_middle_school = 3, person = { name: "Nicole", age: 15 }
<nicoou> || (person)['age'] = ( 15 + 5 )
<nicoou> >> ;(person)
<purr> nicoou: TypeError: object is not a function
<nicoou> :C
<ELLIOTTCABLE> heh
<ELLIOTTCABLE> semicolon before parentheses, in JavaScript.
<ELLIOTTCABLE> ;(person)['age'] = ( 15 + 5 )
<nicoou> oop
<nicoou> i had it too
<nicoou> and deleted it
<nicoou> okay okay
<nicoou> so
<nicoou> || var years_since_middle_school = 3, person = { name: "Nicole", age: 15 }
yrashk has joined #elliottcable
<nicoou> || ;(person)['age'] = ( 15 + 5 )
<nicoou> >> ;(person)
<purr> nicoou: (object) {age: 20, name: 'Nicole'}
<ELLIOTTCABLE> :D
<nicoou> :D
<yorick> (this would make some kind of argument that it's really not ok to rely on ASI without knowing what you're doing)
<ELLIOTTCABLE> one last time, and don't type the number 15 this time. gogogogo
<nicoou> um
<nicoou> || var years_since_middle_school = 3, person = { name: "Nicole", age: 15 }
<nicoou> || ;(person)['age'] = ( age + 5 )
<nicoou> >> ;(person)
<purr> nicoou: ReferenceError: age is not defined
<ELLIOTTCABLE> close, not quite
<nicoou> poop
<ELLIOTTCABLE> same mistake you made first time around; you're referring to the *variable* named age, not the *slot* named age.
<ELLIOTTCABLE> take a break when you're done typing, and go back to your Terminal window for me
<ELLIOTTCABLE> and run this, verbatim: `brew install node`
incomprehensibly is now known as cuttlebone
<nicoou> || var years_since_middle_school = 3, person = { name: "Nicole", age: 15 }
<nicoou> || ;(person)['age'] = ( "age" + 5 )
<nicoou> >> ;(person)
<purr> nicoou: (object) {age: 'age5', name: 'Nicole'}
<ELLIOTTCABLE> okay. back away for a second.
<nicoou> how do i reference it :C
<ELLIOTTCABLE> on the right side, we need an expression. we've talked about that, yes?
<nicoou> yes
<ELLIOTTCABLE> | |15| + |5| |
<ELLIOTTCABLE> we want to replace the expression |15|, with an expression that *evaluates* to 15.
<ELLIOTTCABLE> the operator we're going to use is the same on you're using on the left-hand side, the square brackets:
<ELLIOTTCABLE> | <something>[<something>] | is going to replace |15|.
<ELLIOTTCABLE> that enough of a hint?
<nicoou> hm
<nicoou> this seems silly but
<nicoou> || var years_since_middle_school = 3, person = { name: "Nicole", age: 15 }
<nicoou> || ;(person)['age'] = ( person['age']+5)
<nicoou> >> ;(person)
<purr> nicoou: (object) {age: 20, name: 'Nicole'}
<ELLIOTTCABLE> that's perfect!
<nicoou> yay
<ELLIOTTCABLE> :D
<nicoou> that seemed too simple to try the first time :x
<ELLIOTTCABLE> now, as I mentioned earlier, parentheses have no effect. they're just there to show you where expressions are.
<nicoou> yeah
<ELLIOTTCABLE> so, except for the last line, try removing all the unnecessary parens.
<nicoou> || var years_since_middle_school = 3, person = { name: "Nicole", age: 15 }
<nicoou> || ;person['age'] = person['age'] + 5
<nicoou> >> ;(person)
<purr> nicoou: (object) {age: 20, name: 'Nicole'}
<ELLIOTTCABLE> do you remember why you needed the semicolon?
<nicoou> because parentheses
<nicoou> so i dont need it on the second line?
<ELLIOTTCABLE> yep (=
<nicoou> :D
<ELLIOTTCABLE> okay!
<ELLIOTTCABLE> you're writing code! it's kinda complex! and it works!
<ELLIOTTCABLE> okay.
<ELLIOTTCABLE> did you type that new command into the terminal?
<nicoou> no just doing that
<nicoou> i lost the code :c what was it
<ELLIOTTCABLE> brew install node
<nicoou> so what exactly am i coding
<ELLIOTTCABLE> not to write code
<ELLIOTTCABLE> this is installing something that will help me teach you.
<ELLIOTTCABLE> so, you're doing fairly well with the syntax, and understanding expressions, and writing some JavaScript code,
<ELLIOTTCABLE> let's talk about some high-level stuff for a moment. structure, overall.
<ELLIOTTCABLE> computers don't just magically Run Code For You.
<ELLIOTTCABLE> somebody, somewhere, wrote some code, at some point … that *reads* your code, out of a file, and then somehow works through the process of writing it.
<nicoou> installing * sorry words
<ELLIOTTCABLE> those programs that do that are called “Interpreters.”
<nicoou> okay
<ELLIOTTCABLE> JavaScript is useful primarily because every widely-used web-browser, has a JavaScript ‘interpreter’ built *into* it. That means your web-page's visitors, can run code you send them, in their browser.
<ELLIOTTCABLE> This has all sorts of beneficial effects, but that's not for me to go into here.
<nicoou> okay
<ELLIOTTCABLE> There's *also* a lot of *messiness* to browsers, as a whole. The DOM is hell; the environment is weird in an *even larger* number of horrible, subtle ways than JavaScript is already weird in …
yorick has quit [Remote host closed the connection]
<nicoou> okay..
<ELLIOTTCABLE> so, for you to learn JavaScript, I'm going to teach you to write JavaScript *locally*. That is, the way you would write Ruby, or Lua.
<nicoou> okay
<ELLIOTTCABLE> the `node` program you're installing currently, is basically a hyped-up JavaScript interpreter, built for computers, instead of for browsers.
<ELLIOTTCABLE> it follows all the same rules. (In fact, at its core, it uses Chrome.)
<ELLIOTTCABLE> but it'll allow us a nice, clean, easy environment in which to work with JavaScript, devoid of any browser stuff; that will allow you to learn the browser-specific stuff later, when you already understand the programming language thoroughly.
<nicoou> ahh okay
<ELLIOTTCABLE> lemme know when it's done.
<nicoou> im assuming this means it is
<nicoou>
<ELLIOTTCABLE> yreeeep
<ELLIOTTCABLE> brb
<nicoou> okie dokes
<ELLIOTTCABLE> okies.
<nicoou> hellloo
<ELLIOTTCABLE> sorry, ick
<ELLIOTTCABLE> I'm crashing soon.
<ELLIOTTCABLE> so, let's play with Node a little, and see if I can convey functions to you well
<nicoou> just give me a minute
<ELLIOTTCABLE> kk
<nicoou> prekesh is being an idiot lol
<purr> lol
<ELLIOTTCABLE> fuckinprekesh
<cuttlebone> ELLIOTTCABLE: how2inputbuffer
<ELLIOTTCABLE> cuttlebone: hm?
<cuttlebone> ELLIOTTCABLE: like, when you are parsing in C, for instance
<cuttlebone> ELLIOTTCABLE: you allocate a string for an input buffer
<cuttlebone> ELLIOTTCABLE: what if a variable name is longer than that buffr
<cuttlebone> buffer*
<ELLIOTTCABLE> then don't buffer. stream.
<ELLIOTTCABLE> right?
<cuttlebone> ELLIOTTCABLE: how 2 stream
<ELLIOTTCABLE> character comes in, assign it to various buffers for various things, I guess. idk.
<ELLIOTTCABLE> variable-length buffer for variable names?
<ELLIOTTCABLE> re-allocate and copy the buffer if the newest character comes in pushes it over the previous length?
<ELLIOTTCABLE> pretty standard stuff, huh?
<cuttlebone> ok
<cuttlebone> reallocate
<cuttlebone> do you use realloc
<ELLIOTTCABLE> gods, it's been a while … I've tried, yes, but I think most operating code I've ever written mallocs and trashes, forget what the syscall for that is
<ELLIOTTCABLE> can't remember why :x
<cuttlebone> free()?
<ELLIOTTCABLE> yep
<cuttlebone> so malloc copy and free instead of realloc?
<nicoou> can we call it a night? this is gonna take a while -_-
<cuttlebone> ELLIOTTCABLE: also how 2 unicode in C
<ELLIOTTCABLE> oh gods no
<ELLIOTTCABLE> nicoou: absolutely. I'm in no hurry, if you're not. (=
<ELLIOTTCABLE> nicoou: hell, we don't have to go on, if you're bored. I'm only interested in teaching, if you're interested in learning.
<ELLIOTTCABLE> cuttlebone: that's what I've done in the past, yes.
<nicoou> haha i am! prekkles just needs to talk
<ELLIOTTCABLE> I'd say use realloc and then switch when/if you have a reason.
<nicoou> i seriously appreciate this so much
<ELLIOTTCABLE> prekkies needs to be bouncing on my dick.
<ELLIOTTCABLE> not talking.
<nicoou> LMAO
<ELLIOTTCABLE> bitches dun talk.
<ELLIOTTCABLE> bitches bounce.
* ELLIOTTCABLE waves to prekesh
<nicoou> ahaha
<ELLIOTTCABLE> I'm gonna read my weirdly, unexpectedly excellent martial-scifi book, and sleep soon. been going to bed too late, recently.
<ELLIOTTCABLE> luveu, cuttlebone
<ELLIOTTCABLE> eat a dick, nicoou
<ELLIOTTCABLE> sleep well, everybody
cloudhead has quit [Ping timeout: 252 seconds]
<ELLIOTTCABLE> <3<3<3<3<3
<nicoou> byebye elliott
<ELLIOTTCABLE> <3<3<3<3<3
<nicoou> <3 <3
<purr> Let it be known that nicoou hearts <3.
<ELLIOTTCABLE> LOL
<purr> LOL
<nicoou> AHAHA
<ELLIOTTCABLE> <3 nicoou
<purr> Let it be known that ELLIOTTCABLE hearts nicoou.
<nicoou> :OOOO
<nicoou> scandalous
<ELLIOTTCABLE> oh, don't worry, it only applies to my penis.
<nicoou> LOL
<ELLIOTTCABLE> dun dun DUNNNNNNN~
<nicoou> goodnight elliott LOL
<cuttlebone> ELLIOTTCABLE: so unicode?
<ELLIOTTCABLE> wait, hold on, just so's we're on the same page … everyone present is aware that it's standard practice to trade programming tutorials for mad-nasty, unfettered, wild sex,
<ELLIOTTCABLE> right?
<ELLIOTTCABLE> cuttlebone: depends on what you're *doing*.
<nicoou> LOLLL
<ELLIOTTCABLE> Inputting Unicode and storing it is fairly easy: Be naive, and treat all input as sane UTF-8, and store it away directly …
<nicoou> welp im stuck in winnipeg, too bad c;
<ELLIOTTCABLE> or, try and be a little more intelligent, and do all the full parsing of UTF-8, and store it as UTF-32.
<ELLIOTTCABLE> but that's all assuming you don't want any *knowledge* of the content.
<ELLIOTTCABLE> if you do, you just need to learn a metric fuckton, and implement the parts you need insanely well …
<ELLIOTTCABLE> … or, yes, vendor in the entire ICU library, or similar.
<ELLIOTTCABLE> depends on the exact tasks and size constraints.
<ELLIOTTCABLE> ICU is excellent, but also huge.
<cuttlebone> oh ok
<ELLIOTTCABLE> it's genuinely possible to manually handle *some* tasks.
<ELLIOTTCABLE> for instance, if all you need “out of Unicode,” for your parser, is to A) figure out if characters are within certain character classes … that's fully implementable,
<ELLIOTTCABLE> or B) perhaps you just need to know the *length*, in terms of characters (as opposed to code-points, or graphemes) … that's also reasonably do-able, if you put effort int oti
<ELLIOTTCABLE> but yes, ICS is an excellent go-to if you don't have constraints preventing it.
nicoou has left #elliottcable [#elliottcable]
<ELLIOTTCABLE> readies and sleepies for me, ithink
<cuttlebone> aw k
<cuttlebone> night
alexgordon has quit [Quit: Computer has gone to sleep.]
eligrey has quit [Quit: Leaving]
fwg has joined #elliottcable
fwg has quit [Ping timeout: 256 seconds]
vil has quit [Remote host closed the connection]
vil has joined #elliottcable
fwg has joined #elliottcable
yorick has joined #elliottcable
fwg has quit [Ping timeout: 256 seconds]
<whitequark> ELLIOTTCABLE: when you expand array, do it exponentially
<whitequark> 2->4-
<whitequark> >...32->64->...
<whitequark> less allocations on the cost of a little more memory
<whitequark> there's also more clever algorithms out there, but this works as well.
Sgeo has quit [Read error: Connection reset by peer]
fwg has joined #elliottcable
PragCypher has joined #elliottcable
alexgordon has joined #elliottcable
fwg_ has joined #elliottcable
fwg has quit [Ping timeout: 240 seconds]
<silentbicycle> also, pooling & re-using memory chunks with 2^N-byte sizes is pretty common
<alexgordon> yah
<alexgordon> what are we talking about?
<fwg_> memory allocation strategies?
fwg_ is now known as fwg
fwg has quit [Changing host]
fwg has joined #elliottcable
<alexgordon> in what context?
<alexgordon> oh I forget we have logs
fwg has quit [Read error: Operation timed out]
fwg has joined #elliottcable
eligrey has joined #elliottcable
sharkbot has quit [Remote host closed the connection]
sharkbot has joined #elliottcable
<cuttle> whitequark: yeah that's what I was planning to do
<cuttle> whitequark: thanks
<alexgordon> hi cuttle
<cuttle> hi alexgordon
<whitequark> bullshit-free philosophy
<cuttle> alexgordon: close to being done with a4
<alexgordon> cuttle: cool!
<alexgordon> lol lesswrong
<purr> lol
<whitequark> lesswrong?
<alexgordon> lesswrong was mentioned in the reddit comments
<alexgordon> hate that place
<cuttle> alexgordon: haha why?
<alexgordon> cuttle: because I don't want to end up like the people who contribute to it
<cuttle> hahaha
<cuttle> yeah
<alexgordon> if that's my prize for understanding the universe, I'd rather be ignorant
<alexgordon> the older I get (I hate it when people say this, it's like they implicitly assume that they get wiser with age, I guess it's a coping mechanism)
<cuttle> haha yeah
<alexgordon> ... the more I realize that it's better to be a little bit dumber but very good at a few chosen things that are useful in life
<alexgordon> I like obscure knowledge and thinking about the meaning of life but... it's probably better to know how to dress well
<alexgordon> and actually, I take the same about of pleasure in learning about things *whatever subject it is*
<cuttle> yeah good point
<cuttle> learning about music is effectively useless if you want to know the meaning of the universe
<cuttle> but playing music gives just as much pleasure
<alexgordon> right
<cuttle> this comment is nice though
<alexgordon> I do like reddit though, I've become INFINITELY smarter compared to before I started reading it
<alexgordon> in both obscure knowledge about gravity and real world knowledge about toilet paper
<cuttle> lol yeah
<purr> lol
<alexgordon> I do wonder how people coped before the internet
<cuttle> alexgordon: definitely incomplete, but here it is:
* alexgordon prints to check how many pages it is
<alexgordon> 1 page!
<cuttle> haha
<alexgordon> I think I'll wait for ELLIOTTCABLE to vet this before reading it
<alexgordon> since I know he's going to say "NO NO NO NO"
<cuttle> well i mean it departs a *little* bit from his vision but only in subtle ways
<alexgordon> then I'll have to purge the information from my brain
<cuttle> read this and you'll get the core ideas of paws
<cuttle> no, the core ideas are there
<cuttle> some details about data model, the boring stuff, he will probably disagree wit4h
<cuttle> but the execution model he would agree with
<alexgordon> cuttle: have you read the spec?
<cuttle> alexgordon: no
<alexgordon> -spec @ cuttle
<purr> cuttle: Paws' half-arsed Version 10 specification <http://ell.io/ihQzs>
<cuttle> looks long and unnecessarily filled with pawsjargon
<alexgordon> lol right
<purr> lol
<alexgordon> it is
<cuttle> and there's a huge amount of detail in it devoted to things like the data model
<cuttle> which I think should be vastly simplified/improved
<cuttle> and which is irrelevant to the core idea of paws
<cuttle> and the reactor is an overly-specific way to describe execution, probably necessary for a spec but not for an A4
<ELLIOTTCABLE> lol really? You *credit* reddit to your life?
<ELLIOTTCABLE> As opposed to blaming it for every moment of yours that it's ever wasted?
<ELLIOTTCABLE> You must be Better At Reddit than I.
<cuttle> well I would say that reddit has been one of the many things on the internet that has taught me a lot
<cuttle> but yeah i hate reddit a lot
<alexgordon> ELLIOTTCABLE: both
<alexgordon> ELLIOTTCABLE: it's wasted a lot of my life, but there's tons of wisdom in the askreddit archives
<alexgordon> you can nuke /r/news from orbit though
<alexgordon> and fuck /r/atheism
<cuttle> fuck every subreddit basically
<cuttle> fuck todayilearned the most i'd say
<alexgordon> hahaha
<alexgordon> yeah
<cuttle> "today i learned that steve jobs was an asshole and bill gates was the greatest man to ever live, even greater than jesus"
<cuttle> seven times in the comments, identical to the comments the time it was posted last week:
<alexgordon> ELLIOTTCABLE: the best way to use reddit is to use it to find where really knowledgable people hang out
<cuttle> "there will be statues of bill gates but everyone will forget steve jobs"
<alexgordon> each subreddit has links in the sidebar, often those are the most useful bits
<cuttle> "today i learned something that is actually contradicted in this article, but I just wanted to get on a soapbox"
<alexgordon> /r/science is good because it debunks every scientific news article
<cuttle> well none of them are very convincing anyway :p
<alexgordon> oh and /r/atheism, if anything, has taught me that just because I agree with someone doesn't mean they aren't a cunt
<alexgordon> and the converse of that
<alexgordon> I used to think that agreeing with someone was at least a prerequisite for liking them
<alexgordon> but it turns out backwards idiots can be much nicer to be around than progressive loudmouths
<cuttle> yeah
<cuttle> alexgordon: have you read it yet :o
<alexgordon> "progressive loudmouths" sums up twitter nicely actually
<alexgordon> cuttle: yeah
<cuttle> alexgordon: cool
<cuttle> what do you think
<alexgordon> I think... I'm missing a chunk
<alexgordon> like the spec is giving me the low level implementation details
<alexgordon> and you're giving me the high level motivations
<alexgordon> but
<alexgordon> having trouble getting them to meet in the middle
<cuttle> alexgordon: ignore the spec
<cuttle> alexgordon: you get the whole continuations everywhere thing, right?
<cuttle> like i feel like you get all of paws
<cuttle> that has been designed
<cuttle> and you just keep insisting that you don't
<alexgordon> cuttle: lol not sure
<purr> lol
<cuttle> well i mean
<cuttle> you get the execution model
<cuttle> that's the core of it
<cuttle> all the stuff on top like insanities has not been nailed down
<cuttle> but that has
<cuttle> like this is getting really frustrating
<cuttle> you've built up paws in your mind as this big ol mysterious monolith
<cuttle> when there are a couple parts to it
<cuttle> and you've had them all explained to you
<cuttle> :p
<whitequark> the sad thing about paws is that the whole "continuations everywhere" thing is not exactly novel or very interesting
<whitequark> and I keep hoping the insanities above *are* interesting and/or novel
<whitequark> but no one explains them to me
<whitequark> for, like, months
<whitequark> GIMME MORE
<whitequark> I'm pretty much convinced it can't work and I may or not may be wrong
<whitequark> well there's the graph thing
* alexgordon is doing cryptography weeeeeeeeeeeee
<alexgordon> whitequark: nobody but elliott understands, paws is intrinsically tied up with ELLIOTTCABLE's insanity
<whitequark> so team17 has finally released a version of worms which works natively under linux
<whitequark> worms reloaded that is.
<whitequark> I like how they did not deviate from WWP very much. I don't like they *did* deviate from WWP.
<whitequark> but, I guess it's inevitable.
<fwg> indeed, mr. anderson
fwg has quit [Ping timeout: 240 seconds]
<whitequark> what was that
<whitequark> huh, llvm now includes a cryptographical prng
<whitequark> which, uh, randomizes instruction scheduling decisions
<cuttle> whitequark: i can explain the whole graph bubbling thing to you
<cuttle> alexgordon: jesus christ will you please stop saying that
<cuttle> alexgordon: it's nothing but counterproductive and creates mysticism around a stupidly simple language idea
<whitequark> cuttle: last time it was explained to me, it stopped being interesting right about the time it was all about locking
<cuttle> whitequark: no, that's ownership
<cuttle> whitequark: which will be subsumed into graph bubbling
<whitequark> mmm ok
<whitequark> let's give it another try
<cuttle> ok so
<cuttle> you can enumerate the light cone of a particular event
<cuttle> by looking at every action it has spun off
<cuttle> and every value based on values it has produced
<cuttle> right?
<whitequark> um
<whitequark> well I sort of get it
<whitequark> but what relation does it bear to PLs
<cuttle> so if you carry metadata with your values
<cuttle> then you can, for instance:
<cuttle> when an invariant is violated, instead of throwing an exception, you carry that information outwards with every value and effect that follows from it
<cuttle> so if you want to fix it
<cuttle> you can rewind
<whitequark> uhhh
<whitequark> does it imply paws is pure?
<cuttle> and if it's serious enough that you don't want it to cross the i/o barrier
<cuttle> then i/o operations will not happen as a result of it
<cuttle> because of the metadata
<whitequark> ok so
<whitequark> does that also basically mean that paws never frees memory?
<whitequark> well sort of. it will free some things, but for majority of stuff it stays forever
<cuttle> ...no
<cuttle> you can normally garbage collect
<cuttle> some things are irreversible
<whitequark> so is it like
<cuttle> well i guess things that are rewindable
<whitequark> a value carries a reference to the AST node that generated it?
<cuttle> you can't garbage collect
<cuttle> it's like transactions
<whitequark> hm, so you generate a value which is rewindable, and as long as it is, you can rewind it but not GC it
gozala has quit [Ping timeout: 245 seconds]
<whitequark> and when you're fine with it or want to get some IO, you make it nonrewindable "commit"
<whitequark> that's pretty neat actually
<whitequark> I have no idea if it will work or not
<whitequark> what about values it references?
<whitequark> foo = 1.rewindable
<whitequark> foo += gets.to_i
<whitequark> foo.rewind_assuming(1 => 2)
<whitequark> what will it do?
<whitequark> cuttle: ^
<cuttle> what do you intend for that code to do?
<whitequark> well, it's like common lisp restarts, right?
<whitequark> when shit breaks, you can go "back" (though paws has a different definition of "back") and replace the supposedly faulty value
<whitequark> and restart it
<cuttle> oh ok
<whitequark> so
<whitequark> will that work?
<whitequark> how will it?
<cuttle> hm that's not really the terms i'd thought about it
<cuttle> hm
<alexgordon> cuttle: lol
<purr> lol
<alexgordon> cuttle: do mormons use "joseph smith" as a curse word?
<alexgordon> e.g. "joseph smith will you stop saying that"
<cuttle> hahahaha
jvulc|znc has quit [Ping timeout: 248 seconds]
yorick has quit [Remote host closed the connection]