[00:03:53] * johnnymacs [johnnymacs!~user@13.85.64.199] has joined the channel. [00:48:13] does anyone have an example for define-symbol [01:26:57] * jtimon [jtimon!~quassel@142.29.134.37.dynamic.jazztel.es] has quit (Ping timeout: 256 seconds). [02:45:04] * kentaito [kentaito!4255e38c@gateway/web/freenode/ip.66.85.227.140] has quit (Ping timeout: 260 seconds). [03:23:27] * Kumool [Kumool!~Kumool@adsl-64-237-234-51.prtc.net] has quit (Quit: Leaving). [03:42:23] * pierpa [pierpa!4f0ce24f@gateway/web/freenode/ip.79.12.226.79] has quit (Quit: Page closed). [04:26:26] * pierpal [pierpal!~pierpal@host79-226-dynamic.12-79-r.retail.telecomitalia.it] has joined the channel. [04:54:27] * pierpal [pierpal!~pierpal@host79-226-dynamic.12-79-r.retail.telecomitalia.it] has quit (Read error: Connection reset by peer). [05:09:01] * guuldsneetchh [guuldsneetchh!uid295630@gateway/web/irccloud.com/x-omjjpyzpsaxhnkpg] has joined the channel. [05:10:13] the slava is still missing in action and this makes the snitch a sad snitch [05:11:51] why, the snitch wonders [05:11:57] why be an abandoner, the slave? [05:12:00] * pierpal [pierpal!~pierpal@host79-226-dynamic.12-79-r.retail.telecomitalia.it] has joined the channel. [05:12:05] the slava or the slave? [05:12:09] that is the true question [05:24:27] love is the answer, love the slava, love the factorlang, love the concatenation of concatenative language [05:24:33] but love must be hate also [05:31:30] though only in moderation! <3 [05:35:55] SNITCH OUT! <3 <3 <3 [05:51:42] * xkapastel [xkapastel!uid17782@gateway/web/irccloud.com/x-wosriqkrmyqpdqch] has quit (Quit: Connection closed for inactivity). [06:09:24] * delvinj [delvinj!~Miranda@c-73-164-9-150.hsd1.mn.comcast.net] has quit (Read error: Connection reset by peer). [06:34:27] * pierpal [pierpal!~pierpal@host79-226-dynamic.12-79-r.retail.telecomitalia.it] has quit (Read error: Connection reset by peer). [06:34:40] * pierpal [pierpal!~pierpal@host79-226-dynamic.12-79-r.retail.telecomitalia.it] has joined the channel. [07:20:00] * pierpal [pierpal!~pierpal@host79-226-dynamic.12-79-r.retail.telecomitalia.it] has quit (Ping timeout: 255 seconds). [07:44:12] * kentaito [kentaito!d8f973ac@gateway/web/freenode/ip.216.249.115.172] has joined the channel. [07:44:18] anone up? [08:13:05] * pierpal [pierpal!~pierpal@host79-226-dynamic.12-79-r.retail.telecomitalia.it] has joined the channel. [08:28:39] * kentaito [kentaito!d8f973ac@gateway/web/freenode/ip.216.249.115.172] has quit (Ping timeout: 260 seconds). [09:25:47] * xkapastel [xkapastel!uid17782@gateway/web/irccloud.com/x-xmtevpbziggljkbv] has joined the channel. [09:48:14] * Sonderblade [Sonderblade!~bjourne@n161-p24.eduroam.kth.se] has joined the channel. [10:29:35] * pierpal [pierpal!~pierpal@host79-226-dynamic.12-79-r.retail.telecomitalia.it] has quit (Ping timeout: 240 seconds). [10:47:37] * Sonderblade [Sonderblade!~bjourne@n161-p24.eduroam.kth.se] has quit (Remote host closed the connection). [11:35:24] * xkapastel [xkapastel!uid17782@gateway/web/irccloud.com/x-xmtevpbziggljkbv] has quit (Quit: Connection closed for inactivity). [11:43:56] * xkapastel [xkapastel!uid17782@gateway/web/irccloud.com/x-uenieejjmrsmnegh] has joined the channel. [12:00:13] * pierpal [pierpal!~pierpal@host79-226-dynamic.12-79-r.retail.telecomitalia.it] has joined the channel. [12:00:44] * jtimon [jtimon!~quassel@142.29.134.37.dynamic.jazztel.es] has joined the channel. [13:45:24] * xkapastel [xkapastel!uid17782@gateway/web/irccloud.com/x-uenieejjmrsmnegh] has quit (Quit: Connection closed for inactivity). [14:01:35] * pierpal [pierpal!~pierpal@host79-226-dynamic.12-79-r.retail.telecomitalia.it] has quit (Read error: Connection reset by peer). [14:10:45] * delvinj [delvinj!~Miranda@c-73-164-9-150.hsd1.mn.comcast.net] has joined the channel. [15:03:49] * dustinm` [dustinm`!~dustinm@68.ip-149-56-14.net] has quit (Quit: Leaving). [15:16:38] * dustinm` [dustinm`!~dustinm@68.ip-149-56-14.net] has joined the channel. [15:33:00] * xkapastel [xkapastel!uid17782@gateway/web/irccloud.com/x-tohwtbtljmogcnfh] has joined the channel. [17:24:54] * jtimon [jtimon!~quassel@142.29.134.37.dynamic.jazztel.es] has quit (Ping timeout: 260 seconds). [18:10:06] * jtimon [jtimon!~quassel@142.29.134.37.dynamic.jazztel.es] has joined the channel. [19:23:32] * pierpal [pierpal!~pierpal@host79-226-dynamic.12-79-r.retail.telecomitalia.it] has joined the channel. [20:09:05] * pierpal [pierpal!~pierpal@host79-226-dynamic.12-79-r.retail.telecomitalia.it] has quit (Ping timeout: 248 seconds). [20:38:24] * pierpa [pierpa!4f0ce24f@gateway/web/freenode/ip.79.12.226.79] has joined the channel. [20:42:28] * ChanServ has set mode +o to bmp [20:46:07] * ChanServ has set mode -o to bmp [20:48:34] bmp: i had an idea for local variables [20:48:47] instead of 1 :> a, you would do 1 _a [20:49:12] 1 2 3 ( _a _ b _c ) [20:49:16] no space [20:49:26] to get the value out, you do this: a_ b_ c_ [20:50:00] it would work in stack effects, like: : sq ( _x -- y_ ) x_ x_ * _y ; [20:50:41] and if you wanted to leave x on the stack and not make y a local: : sq ( _x_ -- y ) x_ * ; [20:51:52] the in>> of the stack effect becomes a quotation that is prepended to the word body, and the out>> is appended. variables without underscores are just comments, with underscores they behave like a cleave and get/set the local [20:56:40] this way locals wouldn't shadow any actual words, you don't need extra syntax like :: or :> or :> ( ) [20:57:08] and you get the nice symmetry with stack effects setting/getting before the word body [20:57:58] 1 _x 2 _x ! error [20:58:06] 1 _x! 2 _x! ! ok [20:58:54] _x_ both sets x and gets x, so it's like just naming the stack value [20:58:58] Hmm. [20:59:44] it works with types, too. : sq ( _x_: integer -- y_: integer ) ... ; [21:00:56] none of this local shadowing crap like in C :p locals would be word-scoped, and you can model it with a hashtable (though the compiler would be more efficient) [21:08:08] * Kumool [Kumool!~Kumool@adsl-64-237-238-244.prtc.net] has joined the channel. [21:14:25] * ChanServ has set mode +o to bmp [21:15:00] erg: Okay, this is a recent binge of mine, so please take this with an entire shaker of salt: [21:15:09] I don't like that for exactly one reason, which is it's not trivially searchable. [21:15:21] In particular, we're effectively polluting the namespace (wordspace?) with `_foo` and `foo_` words. [21:15:33] And that won't be trivial to grep why it's happening. [21:15:58] (I have been taking a weird, arguably poorly motivated dive through Tcl, for some context. But that's an actual opinion I hold at this point.) [21:16:12] THAT ALL SAID: I'm *for* simplifying lexical variable access. [21:16:20] So I'd like to talk through some options and see what we can come up with. [21:16:25] they aren't real words, if they were the word would be called `foo` in that case, which you can grep for [21:16:37] That kind of makes my point more strongly, TBH, but I hear you. [21:16:43] i think anywhere we have an underscore would be locals [21:16:49] The strongest thing Factor has is that, literally anywhere I can click something, I can go to docs. [21:16:55] The docs don't always rock, but they're always tehre. [21:16:58] *there [21:17:07] Presumably `_foo` wouldn't be; best-case, `foo` is a dynamic with docs. [21:17:15] Well actually, no. This is lexicals, so it won't even exist. [21:17:22] So I think that is a bit surprising to someone coming through Factor. [21:18:19] Can I ask what we're trying to optimize for? Lexicals honestly feel pretty clean to me right now as-is, given they're accessed just by naming them, and assigned through `:>` (which you can click on/grep for) [21:18:27] Dynamics would seem to be the bigger gap, IMVHO. [21:20:18] I'd look at OCaml if you want a non-Forth to look at that has similar issues. You'd be looking at ref variables, along with (from memory, may be off a bit here) `!` and `<-`. [21:20:21] right now lexical variables don't do anything if you click on them. when you copy/paste code in the listener, if there are any, they are indistinguishable from word identifiers, and likely they are not defined in the snippet you paste [21:20:34] I mean, `:>` exists and can be clicked. [21:20:47] But you're right otherwise. [21:21:09] I guess I'm okay in that narrow space; assignments are obvious and fetches so local there's little confusion. [21:21:29] `disassemble.` is the most confusing thing you can do in that situation, but I'd like to believe that anyone calling that word knows why they're doing it. [21:21:50] but if you think of _ as syntax separate from the identifier, and allow that there is a pseudovocabulary that you can access with _foo and foo_, then you can actually click on these words now since the parser will know they are locals [21:22:09] and if you do foo_ and it's not defined yet, you at least know you were trying to access the foo variable [21:22:41] In your vision, is `foo_` somehow defined local to the...what, quotation? [21:22:45] I'm not clear where you're going with that. [21:22:49] to the word [21:22:58] But I can pass quotations to other words. [21:23:14] not to the quotation, to the word. they get rebinded if you do things like that [21:23:17] Well, backup a step: how's this interact with frying? [21:23:29] Because the example I just started to type was accidentally a fry. [21:23:35] fry is still _ [21:24:02] So are you unifying the two, Tcl-style, where a lexical variable named "" can exist, and that's all a fry is? [21:24:03] 1 2 _x '[ _ + x_ + ] [21:24:15] no, it's literally separate concepts, unrelated :p [21:24:23] You're merging them due to syntax. [21:24:24] just happen to have the same symbol, unfortunately [21:24:29] Well, I'd like to deal with that. [21:24:45] We're prior to 1.0, so "dealing with that" can include anything up to a proposal to eliminate frys. [21:24:47] no, you can't have an unnamed local variable (that's what the datastack is for) [21:24:48] But I just wanna talk through it. [21:25:00] I mean. [21:25:06] oh wow, fry is amazing! i think it would be even better if it worked in arrays [21:25:36] i guess it's kind of like locals, but imagine if you didnt have _ and you had to name all your frys [21:25:56] 1 _x [ x_ 2 + ] === 1 '[ _ 2 + ] [21:25:58] I may be being dumb here, but if you pretend for a second that all fry does is make `'[` go to `gensym123` and then macro `_` to `gensym123_`, isn't that just your new locals? [21:26:14] This can be a good thing. [21:26:17] I'm just trying to work through it. [21:26:25] but the new locals are word-scope, not just quotation-scope like fry [21:26:37] Aaaaaah, okay, I was missing that. [21:26:42] Existing locals are quotation-scoped though, right? [21:26:55] imagine this in C: if(x % 2 == 0) { y = 1; } else { y = 0; } [21:27:00] you have to declare y beforehand [21:27:06] Right. [21:27:07] and you can forget to set it in both branches [21:27:24] Noted?… [21:27:31] in swift they do control flow analysis to prevent this possibility. in Factor, we havet the same problem right now as C [21:27:56] Right. [21:28:08] with the underscore locals, you would have a word-scoped _y y_ and if you accessed y_ before it was set or set _y twice it would error [21:28:09] This is solvable without your proposal, notably, but noted. [21:28:30] That'd be done in the compiler though, right? [21:28:45] Which could already track what happened with `:>` and do the same? [21:29:00] I want to again emphasize really strongly I'm not against this, but I am trying to work through what it's doing we can't now. [21:29:26] here's some super awkward code: :: cube ( x -- y ) x sq :> sq sq x * ; [21:31:21] code bug: :: cube ( x -- y ) x [ sq :> sq ] keep sq * ; ! sq is rebound only in the quotation, the outer square is sq the ``dup *`` word again [21:32:06] the first one rebinds sq to be a local and now you can't tell what's going on in the rest of the word. the second one binds sq and loses it when the quot closes, so the second sq is the word again [21:32:37] : cube ( _x_ -- y ) dup * x_ * ; [21:33:00] : cube2 ( _x_ -- y ) sq x_ * ; [21:33:18] : cube3 ( _x_ -- y ) sq _sq sq_ x_ * ; [21:33:38] it's easy to see what's going on, you don't lose words to variable names, you don't need to worry about losing variables to block scope [21:33:39] <^alex> the _ stuff is turning my stomach a little bit tbh [21:33:42] hehe [21:34:02] it's meant to, current locals are terrible :) [21:34:06] * Kumool is now known as nmz [21:34:43] I genuinely like the current locals--and given I program daily in about four languages that don't include Factor, I'm going to attribute that to something beyond raw familiarity. [21:34:57] But that said, I'm equally trying not to have just a who-moved-my-cheese reaction. [21:36:25] i think the underscores are fine since factor names use dashes and even the C constants that use underscores dont begin/end with underscores [21:36:49] but other symbols would work, like: : cube ( >x> -- y ) dup * x> * ; [21:36:58] it's literally the same thing but s/_/>/ [21:37:00] Dude like erg you work in Windows. [21:37:11] Literally every struct starts with _tag???? [21:37:20] not in factor? [21:37:35] Fine, but you just referenced C constants. [21:37:48] factor C constants are FOO_BAR_BAZ etc sometiems [21:38:24] but combining local variable names isn't very interesting from what i can tell [21:38:53] 1 2 3 ( >a >b >c ) a> b> c> [21:39:01] that would work but we use > for converions already [21:40:36] anyway, i'm not 100% on the idea but i think it's better in namespace collisions (sq renaming example), word-scope (if example), cuts down on syntax, adds symmetry to stack-effects [21:44:51] i meant i do work in windows in factor, but the windows identifier names in factor don't start with underscore [21:46:21] fry is not exactly the same as word-scope locals because each new '[ ] gets its variables from a "new datastack context" for lack of better description [23:00:51] i meant to articulate this better: right now, an identifier can be a word or a local and you can't tell from the name. a local can also shadow a word. if you copy/paste a section of code, you might miss the local assignment, but it might be a word name, so it does whatever the word does in the worst case. if locals are distinguishable by syntax, at worst you will know you are trying to access an [23:00:53] uninitialized variable. the stack checker can even infer the effect of _foo and foo_ with or without assignment [23:05:45] * jeaye [jeaye!~jeaye@unaffiliated/jeaye] has quit (Ping timeout: 265 seconds). [23:20:22] * jeaye [jeaye!~jeaye@unaffiliated/jeaye] has joined the channel.