<whitequark>
hellekin: I dunno why, but asian embedded really, really frequently features such code
<whitequark>
it's not even funny
<hellekin>
whitequark: really? Wow. That's scary.
<hellekin>
When "don't fix it if it works" doesn't apply, for reason that newbies could start contaminating their code with stupidity.
<whitequark>
hellekin: yeah. from a 1.5-second delay for boot led from nops
<whitequark>
to literally such unrolled shell loops I've been shown just days ago by a fellow dev
<whitequark>
I'd say it's scary for another reason
<whitequark>
networked embedded is generally very security-sensitive. and I don't want people writing such code anywhere near anything sensitive.
<hellekin>
true
<hellekin>
I've never learned coding formally, but I would never even think of doing such horrible code
<hellekin>
I'm pretty sure it requires a mouse, because people who knows how to copy-paste with the keyboard cannot be that lazy and stupid. Or can they?
<hellekin>
s/knows/know/
<qi-bot>
hellekin meant: "I'm pretty sure it requires a mouse, because people who know how to copy-paste with the keyboard cannot be that lazy and stupid. Or can they?"
<viric>
sure, acn
<viric>
can
<viric>
people use *fancy* editors for that.
<whitequark>
I don't wanna know...
<hellekin>
it's even longer to type than the real thing. You gotta be braindead to write such "code"
<hellekin>
ah. skip it. There's enough shit in this world
wolfspraul has quit [Quit: leaving]
apelete has quit [Ping timeout: 252 seconds]
qi-bot has quit [Ping timeout: 245 seconds]
<whitequark>
wpwrak: qi-bot is dead
megha has quit [Quit: WeeChat 0.4.0]
LunaVorax has joined #qi-hardware
LunaVorax has quit [Remote host closed the connection]
DocScrutinizer05 has quit [Disconnected by services]
DocScrutinizer05 has joined #qi-hardware
guanucoluis has quit [Quit: Leaving.]
guanucoluis has joined #qi-hardware
dandon_ has joined #qi-hardware
dandon has quit [Ping timeout: 245 seconds]
dandon_ is now known as dandon
gbraad has joined #qi-hardware
gbraad has quit [Changing host]
gbraad has joined #qi-hardware
jekhor has joined #qi-hardware
jekhor has quit [Ping timeout: 245 seconds]
jekhor has joined #qi-hardware
guanucoluis has quit [Ping timeout: 245 seconds]
gbraad has quit [Ping timeout: 264 seconds]
gbraad has joined #qi-hardware
fire has joined #qi-hardware
<DocScrutinizer05>
lol
porchao has quit [Read error: Connection reset by peer]
porchao has joined #qi-hardware
porchao has quit [Read error: Connection reset by peer]
porchao has joined #qi-hardware
<kyak>
viric: offrss downloads an image many times when this image is referred to several times in the same feed (might be the case for a country flag, which might appear in all items of a feed)
<kyak>
viric: since i got rather many feeds (though i managed to clean up down to 45), it would be great to have an indication of status update against every feed. Since chances are high that some will fail with curl or mrss error (this is the case here)
jekhor has quit [Ping timeout: 260 seconds]
<kyak>
viric: one of my use cases was to parse a web site that doesn't have rss and then expose the xml file to google reader. Since now it runs locally, i'd like to point curl to a local file
<kyak>
so i use file:/// as a feed url, but get Error downloading url file:///some/path/file.xml: http status 0
<kyak>
viric: it also seems that curl handles 301 errors strangely
<kyak>
i tried hacking around the "response != 200" to add response code 0 (which curl seems to return for files) - but i only got to segfaults so far :)
<kyak>
viric: it's probably best to forget about handling 301 response code for now. It is better to fix the url manually anyway
<viric>
I guess it'll be a curl flag simply
<kyak>
for command line usage, that would be just a flag.. not sure how it's done in curl lib
<viric>
CURLOPT_FOLLOWLOCATION
<viric>
any example of redirect?
<kyak>
hm, i do "fossil undo", but "fossil diff" still shows the difference.. how can i checkout the latest version of a file?
<viric>
now I see en.gif downloaded multiple times. umh
<kyak>
fossil revert, thanks
<viric>
sorry, I didn't push the redirect change. I set autosync now :)
kilae has joined #qi-hardware
<viric>
now for the images, done...
<kyak>
viric: i confirm, both work. Great, thanks!
<kyak>
viric: btw, i updated the opml2offrss script and attached it to the ticket.. Since all my feeds are converted now, i don't think i'll be doing any changes to the script anymore. Unless another user pops up and finds a bug
<viric>
perfect
<viric>
kyak: I added *noimages*
<kyak>
viric: going to check it in a few..
<kyak>
viric: i'm looking at html source
<viric>
ok
<kyak>
looks a bit strange
<kyak>
you have three html forms on top
<kyak>
i suppose, one for "show read", another for "remote images", the third for "single page"
<kyak>
but, all of these three forms contain input types for other forms...
<viric>
I'm not very good at html
<kyak>
ok, lemme try to fix this
<kyak>
i guess one form would do it
<kyak>
will check the *noimages* first
unclouded has quit [Ping timeout: 245 seconds]
<kyak>
yep, it just works! thanks!
<viric>
I've to leave for a while. I'll check the file:// later. :)
rz2k has joined #qi-hardware
qi-bot has joined #qi-hardware
viric has quit [Quit: reiniciem]
viric has joined #qi-hardware
baba has joined #qi-hardware
fire has quit [Ping timeout: 245 seconds]
jekhor has joined #qi-hardware
wej has joined #qi-hardware
rz2k has quit []
wolfspraul has joined #qi-hardware
wej has quit [Ping timeout: 248 seconds]
wej has joined #qi-hardware
pcercuei has joined #qi-hardware
pcercuei has quit [Read error: Connection reset by peer]
pcercuei has joined #qi-hardware
pcercuei has quit [Client Quit]
pcercuei has joined #qi-hardware
rz2k has joined #qi-hardware
jekhor has quit [Ping timeout: 240 seconds]
pcercuei has quit [Ping timeout: 264 seconds]
gbraad has quit [Ping timeout: 252 seconds]
wej has quit [Ping timeout: 245 seconds]
pcercuei has joined #qi-hardware
dlan^ has quit [Remote host closed the connection]
dennis has quit [Remote host closed the connection]
guanucoluis has joined #qi-hardware
LunaVorax has joined #qi-hardware
LunaVorax has quit [Ping timeout: 260 seconds]
LunaVorax has joined #qi-hardware
wej has joined #qi-hardware
pcercuei has joined #qi-hardware
<kyak>
viric: it's more clear now for me why you have to create the complete query every time
<kyak>
i.e. even if i change one parameter, i send all the others in the form as well
<kyak>
it is also clear now why C is not something one should use to handle WEB :)
<kyak>
the problem is, you don't have persistent storage.. You fork every time for new request, and children don't have any knowledge about the client's state
<kyak>
that is why, the client has to send the complete state every time: "show read", "single page", "local image" and so on..
<kyak>
..and it took me hell of a lot of time to realize why "extern" variable is reset to 0 every time
<kyak>
because of fork, of course
<whitequark>
my compiler can now infer types for and compile fib()!
<larsc>
10.times ? so you can do like Integer n = 5; n.times { ... }?
LunaVorax has quit [Ping timeout: 260 seconds]
<whitequark>
larsc: why "Integer n = 5"? just n = 5; n.times { ... }
<whitequark>
and yes I can
<whitequark>
the compiler features both local type inference by bidirectional dataflow analysis on static single information form and interprocedural type inference via cartesian product algorithm
<larsc>
how does the algorithem work? I'm currently working on something very similar for migen
<whitequark>
larsc: which one?
<larsc>
type inference
<whitequark>
well there are two: local and interprocedural :)
<larsc>
start with local
<whitequark>
it's a distant derivative of Hindley-Milner
<whitequark>
my IR is in SSA/SSI form, which can be thought of a purely functional language (SSA is isomorphic to CPS, used in functional compilers)
<whitequark>
so HM works perfectly on the SSA values
<whitequark>
type unification in canonical HM corresponds to SSA phi nodes
<larsc>
the current migen algorithem, if you even can all it that, is dead stupid. just tries to derive the type 'for' each signal in a loop until each signal has one
<whitequark>
larsc: HM is not significantly more clever
<whitequark>
but it can handle conflicts
<whitequark>
like e.g. if foo; 1; else "2"; end
<whitequark>
the HM-derived resulting type would be Integer|String
<whitequark>
what I do in these cases is restrict the resulting unions so that runtime perf would be manageable
<whitequark>
TrueClass|FalseClass is reduced to Boolean (internal, not ruby type)
<whitequark>
Base|Derived is reduced to Base
<whitequark>
UnrelatedA|UnrelatedB is reduced to Object, well, because everything inherits from Object
<larsc>
makes sense
<whitequark>
also NilClass|Whatever is reduced to nullable<Whatever>
<whitequark>
and that's mostly all
<whitequark>
otherwise you would end up with union types which would require essentially dynamic dispatch
<whitequark>
and perf will go nowhere
<whitequark>
also I handle types for mutable local bindings in a very similar fashion
<larsc>
mutable local bindings?
<whitequark>
aka "variables" :)
<larsc>
ah, ok
<whitequark>
the kink with local variables is that they're mutable and HM is purely functional
<whitequark>
loop { a = 1; a = "2" if rand > 0.5; p a }
<viric>
kyak: I fork in offrss because I don't want memory leaks
<whitequark>
larsc: now there's also upwards DFA, which handles closures
<whitequark>
see, the type of a closure is derived from its usage, as opposed to definition
<viric>
kyak: and it's a matter of taste, when to fork.
<whitequark>
larsc: def loop(&block); while true; block.call(); end; end
<viric>
kyak: I fork at the very start, because it's like CGI. I don't think I need much persistent storage. Does it run slow for you?
<whitequark>
larsc: as you can see this method has a well-defined type of `block', but downwards DFA could not infer it...
<whitequark>
larsc: the other clever thing one could do with bidi-DFA is latent predicates
<whitequark>
larsc: for example this: def foo(bar); if bar.is_a?(Integer); bar + 1; else nil; end; end
<whitequark>
larsc: without #is_a?(Integer), the method could not typecheck if I pass a String there
<whitequark>
*would
<larsc>
i see
<kyak>
viric: nah, it's not slow at all. I just don't like the way you have to construct the complete query (i.e. configuration) every time
<whitequark>
larsc: it's like pattern matching from haskell, but with none of the monads :D
<kyak>
viric: it looks redundant in C code, and you have to think about the complete configuration all the time
<whitequark>
larsc: now, interprocedural inference is even simpler. imagine that every function, initially, has a polytype where each argument is assigned its own type variable
<kyak>
viric: why am i even talking about - i'd like to have "mark all as read" button, and the design is such that it can't be easily extended
<viric>
kyak: I could use a cookie. But I never learnt cookies
<whitequark>
larsc: forall(a,b) Integer#+(a self, b other)
<whitequark>
larsc: note how self doesn't have a monotype either. this is because you can inherit from Integer, and in the derived class self would not have the type Integer
pcercuei has quit [Ping timeout: 245 seconds]
<viric>
kyak: yes, web without cookies is harder. :) Maybe they'd really simplify all
<whitequark>
larsc: now, if you encounter a call, say, (Fixnum < Integer) Integer#+(Fixnum 1, Fixnum 2), you specialize the method for that particular call site.
<viric>
kyak: but then the state is not per browser window, but per browser.
<larsc>
whitequark: what does #+ do?
<whitequark>
larsc: addition
<whitequark>
1 + 2
pcercuei has joined #qi-hardware
<whitequark>
# is just a separator between class name and method name.
<larsc>
and the hash means that it's a method of the type... ok
<whitequark>
larsc: so, now instead of a method which can accept anything you have a method which only accepts Fixnums
<whitequark>
so you can eliminate a ton of redundancy. type checks, range checks (sometimes), etc. you can do inlining. it's awesome actually
<whitequark>
you can do partial specialization. say if you don't know what the second argument is, you infer forall(a) Integer#+(Fixnum 1, a var)
LunaVorax has joined #qi-hardware
<whitequark>
you still can eliminate half of the redundancy and maybe inline the method
<whitequark>
and the algorithm is closed over composition, that is, you can specialize the methods over and over again if you know more and more about your code
<kyak>
viric: i'll try to implement that button, and we'll see how it goes. If it turns into a monster, perhaps it's a good sign to rewrite server.c :)
<whitequark>
larsc: what's even more interesting is what happens when you get to parametric types. you can do restrictions on type variables!
<whitequark>
say we have a generic List
<whitequark>
forall(a) List#append(List<a> self, a elem)
<viric>
kyak: ok :) think of a cookies model if you want
<whitequark>
larsc: this method can be specialized for any element type, but only ones which match the type of the list
<whitequark>
what actually happens is that
<whitequark>
you speculate that you can specialize this method for List<Integer>, so you basically replace a with Integer
<whitequark>
then, if the result, being substituted at the original callsite, still typechecks, this means we're good
<whitequark>
otherwise someone screwed up :)
<larsc>
so what does forall do?
<larsc>
is it a predicate?
<whitequark>
∀
<whitequark>
hah, I actually have this on my compose key
<whitequark>
yes.
<whitequark>
it does not figure in the language syntax itself, of course (neither does `#'); I'm using this because it's common notation
<kyak>
viric: i just want to make it completely clear. For example, when i click the yet-to-be-implemented "mark all as read" button, i need to send not just the state of this button, but also all the other states - like "show read", "local images" etc. Otherwise, the state of the client (my web browser session) would become inconsistent. For example, clicking this button would reset the "local images" button state
<whitequark>
you can think of it as a type constructor, if that's simpler. λ→a.List<a>→a→List<a>
<larsc>
yea
<viric>
kyak: I think you are not very used to web programming :)
<whitequark>
larsc: ok. so. when you already have types dependent on terms, you can add types dependent on values!
<viric>
kyak: or are you?
<whitequark>
for example forall(Integer a) MachineInt<a width>
<whitequark>
you see where it goes :)
<larsc>
no
<whitequark>
ok
<viric>
kyak: I mean... one think would be to have a persistent storage based on some id, that identifies the browser windows. But that's not very common I think; Most people use cookies, and cookies are per browser and not per window.
<whitequark>
larsc: MachineInt is a generic class, but it does not accept a type as its parameter, but a value (constant number)
<viric>
kyak: giving weird results if you have multiple windows on the same served pages.
<whitequark>
larsc: the intended result is that we can get to manipulate this number both in the type system, as if it were a type, and, say, typecheck machine int addition:
<viric>
kyak: but persistent storage would allow to pass only an id instead of all. But whether it's hard to send an id or send all, is a matter of good programming. Of course I wrote offrss with some kind of 'minimal effort for what I need'. I'll see if I can improve what you want. :)
<whitequark>
larsc: forall(Integer a) MachineInt#+(MachineInt<a> self, MachineInt<a> other)
<kyak>
viric: i have no idea why you start talking about browser windows. I'm only talking about one window, or one tab now
<viric>
kyak: yes, but multiple tabs has to work too
<viric>
(at least, I want it to work)
<viric>
:)
<viric>
well, I'm sorry but I've to leave now. Tomorrow more!
<larsc>
hm
<viric>
kyak: I quite finished a recent project that took my time, and I can get into it
<whitequark>
larsc: *and* also as a value. for example: class MachineInt; def <<(Integer bits); raise ArgumentError if bits > @@width; ...; end; end
<viric>
пока!
<kyak>
пока :)
<whitequark>
larsc: (@@width would be a Ruby syntax to extract the value from the corresponding type parameter)
<larsc>
ok
<whitequark>
larsc: so, as you can see, we take here a type, governed and enforced by type system rules, and compare it with a user-provided value!
<whitequark>
(in order to prohibit shifts too wide to handle, or whatever)
<whitequark>
now, the most interesting part of this everything is how it works with Ruby metaprogramming
<whitequark>
and the answer, it works so well that C++ programmers will die from envy :)
<larsc>
hehe
<whitequark>
a Ruby class is a type; a Ruby class is also a value; the type system can represent and work with both classes and plain old data
<whitequark>
and you can directly manipulate everything of this with just Ruby code
<whitequark>
so, if you need a friggin' compile-time loop, you go and write `while' there. no weird template magic attached
<whitequark>
if you need to define a method derived from some other runtime property, here you are
<whitequark>
dynamically generate constant? ok
<whitequark>
so we have a language which is as fast as C++, strictly more powerful and way easier to write in :D
<whitequark>
also if you're going to do something similar, please note that type variables are only a property of, and attached to, and have sense in the context of functions.
<larsc>
and I guess you'll be able to attract ruby programmers
<whitequark>
larsc: that is the point. Ruby, Python, JS, *and* C++ (because some of them do have sense)
<whitequark>
the main reasons I chose Ruby as the base for the language are: 1) it is quite well-known 2) sensible, Smalltalk-derived OO model, unlike Java/C++ 3) easy and mostly quite logical metaprogramming
<whitequark>
3) is a total clusterfuck in python
<larsc>
tried that today
<whitequark>
that didn't stop someone from writing a thing similar to mine called Starkiller as a phd project
<whitequark>
it is however too academic to be usable
<whitequark>
WAY too academic.
<whitequark>
ruby's syntax is sometimes really meh (seriously, \C-? in the core of the language?!), but I can fix that
<whitequark>
ruby's stdlib is sometimes (quite rarely) weird, but that's simple and I will fix that
<whitequark>
whoever wrote Encoding support was high on something evil
<whitequark>
oh some other features I have for free in ruby:
<whitequark>
- interpolations. if you write stuff like "this is a long format string: #{foo.to_s}" then what happens? the first part of the long format string is stored in the .rodata; result of foo.to_s is calculated; these two are combined into a rope.
<whitequark>
... which is an implementation detail completely transparent to user code, because user code iterates strings with #each
<whitequark>
so you can have *very* efficient iteration which is also flash-friendly
<larsc>
but also means that strings are a core feature of the language
<whitequark>
they are indeed
<whitequark>
even more; in Foundry, UTF-8 is a core feature of the language. (Unless you disable it, but I advise strongly against.)
<whitequark>
it stores data in UTF-8 to save space and iterates it as UTF-16 or UTF-32 (machine words are 32-bit anyway). corner cases such as surrogate pairs are already handled.
<larsc>
I guess one advantage when you are dealing with hdl languages is that all objects are instantiated at synthesis time, so you don't have to deal with unions
<whitequark>
larsc: indeed
<whitequark>
HDL is much more declarative than Foundry
<whitequark>
it's *completely* declarative D:
<whitequark>
*:D
<larsc>
although it could come in handy knowing which types are compatible, so you can do time multiplexed sharing of blocks
<whitequark>
yea
<whitequark>
larsc: one thing I was also thinking about is deeply integrating regexps within compiler
<whitequark>
so that during compilation it would generate the optimal state machine
<larsc>
uh
<larsc>
yea, precompling the regex may make sense
<whitequark>
you could then trivially parse URIs or HTTP or whatnot; flex is essentially a regexp -> state machine generator either.
<whitequark>
it can simply invoke ragel and then link the result, as I'm ABI-compatible with C
<whitequark>
and LLVM's LTO means that it won't generate cruft on the boundary
<larsc>
isn't there this google lib for efficent regexes?
<whitequark>
larsc: hm, not sure
<whitequark>
ruby uses oniguruma. a ruby parser in oniguruma is 2x slower than ruby parser in flex+bison
<whitequark>
which I guess means that oniguruma is a hell of a fast library
<larsc>
re2
<larsc>
a nfa based regex implementation
<whitequark>
yea I see
<whitequark>
I wonder if I can disembowel it and generate LLVM or C from the result