In which @error solicits recommendations and feedback
-
@PJH true enough
In that vein, you could use something utterly impenetrable and open sores like Ragel or SMC to define the state machine, generating both code and documentation automagically.
For extra bonus cuntery points, SMC requires Java.
-
@tufty said in In which @error solicits recommendations and feedback:
RTF is an encapsulation format, not, as was requested, a diagram format.
Blarp blarp blarp, what I'm saying is if programmers were interested in moving past 1976 at any point in the last 30 years, maybe we'd have IDEs that supported rich text (whatever specific pedantic dickweed format that is!) code files that you could embed images and chart and such in.
@tufty said in In which @error solicits recommendations and feedback:
An image file encapsulated in an RTF file fails what was requested totally - you can't effectively version control any binary blob
Right; because programmers are stuck in 1976 and so they build source control tools as if it were still 1976.
There's no law of nature saying it's impossible to version control documents with diagrams in it (Word somehow manages it!), it's just shitty programmers writing shitty tools like it's still shitty 1976 that's the problem.
-
@blakeyrat There is still no better text editor than VIM, graph language better than DOT, or movie better than Monty Python and the Holy Grail. Deal with it.
-
@fbmac Emacs, Visio (is that the one? whatever), Foodfight
.
.
.
.
.
.
.
.
.
.
psst, anyone got more fuel?
-
@blakeyrat You can version control documents with images in them fine. But you can't version control the images themselves in any semantic manner.
You can say "these bytes in the bytestream changed", or, at best, "this pixel was white and is now light grey", but that gives you no information about the information carried by the image itself. As opposed to a representation where you can say "this state was called 'waiting_input' and leads to 'blakeyrat_replies', but is now called 'tumbleweed' and is a dead end". Or even, if you go for something with less semantic content (svg, for example) "this rectangle used to measure 120 by 40 pixels and contain the text 'waiting_input' in a sans-serif font at 24 points, but now uses a serif font at 32 points and is 64 pixels high"
The only way you can really get away with a binary blob diagram is if it is generated automatically from the source code. In which case you don't need to version control it anyway. But that would require a "sufficiently smart toolset".
Wordpad is not a "sufficiently smart toolset"
-
@tufty said in In which @error solicits recommendations and feedback:
Wordpad is not a "sufficiently smart toolset"
Ok? People have said this like 4 times, and I've agreed with it like 4 times, how many more do we need before we can move on? Christ.
-
@blakeyrat we need 5 to make it a prime number
-
@error you can do some more tweaking, like adding the
left to right
command instead of the defaulttop to bottom
, and the number of dashes in an arrow->
or-->
also indicates direction, but eventually it's up to graphviz in the backend how to lay things out.
-
@blakeyrat said in In which @error solicits recommendations and feedback:
@tufty said in In which @error solicits recommendations and feedback:
Wordpad is not a "sufficiently smart toolset"
Ok? People have said this like 4 times, and I've agreed with it like 4 times, how many more do we need before we can move on? Christ.
Given that literally your last post in this thread before this one was
@blakeyrat said in In which @error solicits recommendations and feedback:
@Hanzo Ok well the one specific file format I offhandedly suggested is apparently unsuitable according to you, so fuck progress. If that specific idea doesn't work, I guess we should totally give up on every improving anything ever.
Thank you for posting that, you have opened my eyes.
the casual reader might, in fact, be justified in thinking that you were doing anything but agreeing. But that's in a world where words mean what they appear to mean, rather than the absolute diametric fucking opposite.
-
@Mikael_Svahnberg said in In which @error solicits recommendations and feedback:
eventually it's up to graphviz in the backend how to lay things out.
Oh, it's a layer on top of it? Is it a transpiler?
-
@error said in In which @error solicits recommendations and feedback:
@Mikael_Svahnberg said in In which @error solicits recommendations and feedback:
eventually it's up to graphviz in the backend how to lay things out.
Oh, it's a layer on top of it? Is it a transpiler?
Except that that sounds more like a veneral disease, I guess so. I haven't bothered to look into it, but given that one command line option is to "use the experimental built-in dot parser instead of the external program" (freely quoted from memory), it would certainly seem so. But it does a good job of presenting a cleaner syntax for UML purposes.
-
@Mikael_Svahnberg It's got Atom plugins available so I'll give it a shot.
<3
Edit: Yeah, this is much more expressive! Thanks!
-
@Hanzo said in In which @error solicits recommendations and feedback:
<some arbitrary="" year="">
Why do people insist on writing nonstandard HTML?
-
@ben_lubar people will pervert any technology with margin to be abused
-
@ben_lubar said in In which @error solicits recommendations and feedback:
Why do people insist on writing nonstandard HTML?
Looks like a reasonable XML fragment.
-
@ben_lubar said in In which @error solicits recommendations and feedback:
@Hanzo said in In which @error solicits recommendations and feedback:
<some arbitrary="" year="">
Why do people insist on writing nonstandard HTML?
I wrote something else, but "some forum software" took it upon itself to rewrite it into XML. I think I wrote <some arbitrary year>, but with the symbols you see, not the HTML character entities.
-
@Hanzo said in In which @error solicits recommendations and feedback:
@ben_lubar said in In which @error solicits recommendations and feedback:
@Hanzo said in In which @error solicits recommendations and feedback:
<some arbitrary="" year="">
Why do people insist on writing nonstandard HTML?
I wrote something else, but "some forum software" took it upon itself to rewrite it into XML. I think I wrote <some arbitrary year>, but with the symbols you see, not the HTML character entities.
This is on a forum where we allow bold text and italic text, but
<some>
isn't on the whitelist.
-
@ben_lubar And the escaping needs to happen before the tag standardization >.>
-
@Yamikuronue said in In which @error solicits recommendations and feedback:
@ben_lubar And the escaping needs to happen before the tag standardization >.>
Are you proposing I write my own HTML parser?
-
@ben_lubar I'm proposing you find a parser that doesn't change the text it's parsing.
-
@Yamikuronue said in In which @error solicits recommendations and feedback:
I'm proposing you find a parser that doesn't change the text it's parsing.
No, he's firmly in the Markdown camp, full of people who think parsers should fuck shit up.
-
Here's the part where I solicit feedback:
Does that seem like a viable bot architecture? @SockDevs @BotOwners
I plan to turn these diagrams into behavior trees, which I already have a rudimentary implementation for.
-
@error That looks very similar to SockBot IMO
-
@Yamikuronue said in In which @error solicits recommendations and feedback:
@error That looks very similar to SockBot IMO
indeed, it looks a lot like sockbot, although since version 3.0 sockbot doesn't use explicit queues, instead it uses promises, but the concept's pretty much the same.
-
@accalia said in In which @error solicits recommendations and feedback:
@Yamikuronue said in In which @error solicits recommendations and feedback:
@error That looks very similar to SockBot IMO
indeed, it looks a lot like sockbot, although since version 3.0 sockbot doesn't use explicit queues, instead it uses promises, but the concept's pretty much the same.
Actually they are using promises in my architecture as well. I just thought that was more of an implementation detail.
-
@error said in In which @error solicits recommendations and feedback:
Actually they are using promises in my architecture as well. I just thought that was more of an implementation detail.
More accurately I am using
async
functions, which are implemented using generators and promises.
-
@error said in In which @error solicits recommendations and feedback:
I just thought that was more of an implementation detail.
more design methodology than implementation detail.
Promises are easier to work with for async operations than the more traditional CPS extoled by node core. ;-)
-
import { wait } from './time'; // code is written as if synchronous, but foo actually returns a Promise async function foo() { for( let i = 0; i < 5; ++i ) { const baz = await bar(); if( baz ) { await baz(); await wait( 1000 ); } } }
-
@error is that..... coffee script?
it sure isn't javascript and i'm certain it's not typescript.... well nearly certain.
and yeah await would be an even better way to handle it, but that's part of the as yet barely started ES7 standard.
-
@accalia said in In which @error solicits recommendations and feedback:
@error is that..... coffee script?
it sure isn't javascript and i'm certain it's not typescript.... well nearly certain.
and yeah await would be an even better way to handle it, but that's part of the as yet barely started ES7 standard.
It's ES7, which is TypeScript compatible. Error-bot is TypeScript.
-
@error said in In which @error solicits recommendations and feedback:
Error-bot is TypeScript.
:do_not_want.png:
-
@accalia said in In which @error solicits recommendations and feedback:
@error said in In which @error solicits recommendations and feedback:
Error-bot is TypeScript.
:do_not_want.png:
Why exactly? I think TypeScript is the bee's knees. I love superset languages. It aligns very well with ES.
-
Damn it, now you're really making me want to work on a C++ implementation of NodeBB API just so I can out-WTF you all! :P
-
@error said in In which @error solicits recommendations and feedback:
@accalia said in In which @error solicits recommendations and feedback:
@error said in In which @error solicits recommendations and feedback:
Error-bot is TypeScript.
:do_not_want.png:
Why exactly? I think TypeScript is the bee's knees. I love superset languages. It aligns very well with ES.
show me a browser that understands TS natively and i'll bother with it.
if you are going to write for the browser, write for the browser. none of this fancy transpiling or meta languages. i want it so that if my shit breaks it's because it was my shit or because i did something unsupported in the browser, not because of some bug in the transpiler that caused it to warp off into hyperspace and i have to figure out what ecxactly caused it to do that so i can make it stop doing that.
give me just the one thing to debug, thank you.
-
@accalia Fair enough, but I can count on zero hands the number of times the transpiler introduced a bug, and I don't have enough hands and feet to count the bugs it has caught for me at compile time.
-
@error said in In which @error solicits recommendations and feedback:
@accalia Fair enough, but I can count on zero hands the number of times the transpiler introduced a bug, and I don't have enough hands and feet to count the bugs it has caught for me at compile time.
even if i accept that.... tell me. how do i debug an issue with my transpiled code? what happens when the bug is syntactically valid and it's only at run time that ti goes bonkers? how do i trace back from the generated script to my code to determine where the issue started?
in short: I can debug the javascript live, how can i debug the typescript at all?
-
@accalia said in In which @error solicits recommendations and feedback:
@error said in In which @error solicits recommendations and feedback:
@accalia Fair enough, but I can count on zero hands the number of times the transpiler introduced a bug, and I don't have enough hands and feet to count the bugs it has caught for me at compile time.
even if i accept that.... tell me. how do i debug an issue with my transpiled code? what happens when the bug is syntactically valid and it's only at run time that ti goes bonkers? how do i trace back from the generated script to my code to determine where the issue started?
in short: I can debug the javascript live, how can i debug the typescript at all?
Is this a trick question? Like this:
-
Hint:
-
I also used the following pattern, (TypeScript shown but it's nearly valid ES6):
return Promise.race<any>( [ waiter.waitFor( socket, 'error' ), waiter.waitFor( socket, 'connect' ), wait( connectTimeout ).then( () => Promise.reject( new Error( 'connect timeout' ) ) ) ] ).then( () => new NodeBBSocket( { socket } ) );
Where
waiter.waitFor
is something like:waitFor( socket, event ) { return new Promise( ( resolve, reject ) => { socket.once( event, ( error, ...values ) => { if( error ) { reject( error ); } else { resolve( values ); } } ); } ); }
(Re: our earlier discussion about
setTimeout
)
-
New question:
I have a function that I intend to act as afinally
block for Promises. I'd love to call itfinally
but that's a reserved word.export function finally<T>( promise: PromiseLike<T>, fn: () => any | PromiseLike<any> ): Promise<T> { return Promise.resolve( promise ) .catch() // execute next part regardless of original result .then( () => fn() ) .catch() // don't worry about errors in the finally .then( () => promise ); // return original result (resolved or rejected) }
Here are the specs I will test for it:
- Waits for a Promise
- Does some action after the Promise completes (regardless of result)
- Ignores the result of the action
- Waits for the action to complete
- Resolves or rejects with the same result as the original Promise
Any ideas on another name that conveys the intent accurately?
Edit: It would work as a method on the
Promise
prototype, but I don't believe in modifying shared objects. I could maybe write a class that extendsPromise
and implement[Symbol.species]
... But that's not pretty at all.
-
@accalia said in In which @error solicits recommendations and feedback:
if you are going to write for the browser, write for the browser
What if I'm writing for Node? ;)
I'd actually be open to playing with a super-JS language in sockdrawer stuff. But the great thing is it's totally compatible, so I could write a plugin in TypeScript for a Core in pure JS.
-
@error said in In which @error solicits recommendations and feedback:
I have a function that I intend to act as a
finally
block for Promises. I'd love to call itfinally
but that's a reserved word.Any ideas on another name that conveys the intent accurately?
Tentatively proceeding with
thenFinally
.
-
@error
return Promise.resolve( promise )
That's weird, why are you doing that? Smells off.
I don't have better name suggestions at the moment.
-
@Yamikuronue said in In which @error solicits recommendations and feedback:
That's weird, why are you doing that? Smells off.
Converts a
PromiseLike
to aPromise
.PromiseLike
s can do weird things, as their contract is less demanding.Edit: To be clear,
PromiseLike
is simply the interface of having athen
method that accepts zero, one, or two functions as parameters. Promises have a well-defined behavior of chaining and unwrapping (and acatch
sugar method). So I take a less well-defined interface and convert it to a more well-defined class. I could just say it accepts aPromise
instead of aPromiseLike
, but it was easy enough to support both with just thePromise.resolve
call.
-
@error Is there a reason you're allowing mixed promises? I feel like now that Promise is standard we're moving away from PromiseLikes as a community.
-
@Yamikuronue said in In which @error solicits recommendations and feedback:
@error Is there a reason you're allowing mixed promises? I feel like now that Promise is standard we're moving away from PromiseLikes as a community.
My codebase doesn't actually have any non-
Promise
PromiseLike
s, but why require more in the contract than strictly necessary? I prefer to err on the side of requesting an interface, not a specific implementation.
-
@error said in In which @error solicits recommendations and feedback:
I prefer to err on the side of requesting an interface, not a specific implementation.
I prefer to err on the side of readability; something that looks wrong but is right is going to train the eye to ignore things that look wrong :)
Accalia and I have this discussion every code review, so you're in good company wanting more future-proofing and less readability, I figured I'd just throw my .0002 out there
-
@Yamikuronue said in In which @error solicits recommendations and feedback:
@error said in In which @error solicits recommendations and feedback:
I prefer to err on the side of requesting an interface, not a specific implementation.
I prefer to err on the side of readability; something that looks wrong but is right is going to train the eye to ignore things that look wrong :)
Accalia and I have this discussion every code review, so you're in good company wanting more future-proofing and less readability, I figured I'd just throw my .0002 out there
You're a mod so you can view the history, right? I actually d the post to change it from accepting a
Promise
without aresolve
call, to the state you see now.
Filed under: Who am I kidding? Edit history! What is this, ?
-
@error said in In which @error solicits recommendations and feedback:
you can view the history, right?
-
As much as possible, I'd rather have input parameters accept interfaces only, rather than instances of specific classes/prototypes. I return the more traditional type. E.g. accept
ArrayLike
, returnArray
. ES doesn't really have that distinction, but TypeScript does (though, oddly, you can useimplements
with a class).