|
prisoner of waffles posted:tell us what language has "real modules" and we'll try to figure out how they are different from packages yeah i dont have a good definition of what a module is. but i think go packages are not a good substitute for modules/namespaces because go packages are closer to objects since they are initialized with state.
|
# ? Sep 17, 2017 22:05 |
|
|
# ? May 17, 2024 02:53 |
|
prisoner of waffles posted:tell us what language has "real modules" and we'll try to figure out how they are different from packages ML
|
# ? Sep 17, 2017 22:08 |
|
So what problems can you solve with ML modules? They do their generics using modules parameterized with the generic types? Cool but like, what else do they get used for? (Would legit prefer to have someone tell me over learning this on my own lol)
|
# ? Sep 17, 2017 22:11 |
|
prisoner of waffles posted:So what problems can you solve with ML modules? They do their generics using modules parameterized with the generic types? Cool but like, what else do they get used for? Modules allow you to parametrise over types, values/functions, and other modules. That's it. It's an powerful technique (if somewhat verbose). What more do you want? It is used for bog-standard generic programming, but also for nice tricks like pairing an arbitrary regex frontend to an arbitrary regex backend, so you can get the syntax and operational behaviour you want. (I never see this used much in practise.) However, the ML module system does not directly deal with how programs are split into files. That's done by the ML Basis system, which is a pretty lightweight mechanism. This notion of abstracting over the practical fact that all programs are split into files is a relic of older languages, I think.
|
# ? Sep 17, 2017 22:50 |
|
prisoner of waffles posted:If nothing else, Go gives a good example of what a modernized C looks like, has surprisingly pleasant tooling (gofmt and godoc, e.g.), and a standard library that actually includes things like http and json Perfection (in a standard library) is achieved not when there is nothing left to add, but when there is nothing left to take away For everything else, there is the standard package manager and its open source repository
|
# ? Sep 17, 2017 22:54 |
|
God help me and my deepening case of brain worms but I am actually starting to like JavaScript. Triple equals really seems to solve a lot of its worst bullshit. and things like destructuring and async/await are very hard to do without once you get used to them
|
# ? Sep 17, 2017 22:57 |
|
Sapozhnik posted:God help me and my deepening case of brain worms but I am actually starting to like JavaScript. Triple equals really seems to solve a lot of its worst bullshit. and things like destructuring and async/await are very hard to do without once you get used to them danger, pull up pull up
|
# ? Sep 17, 2017 23:12 |
|
Replace JavaScript with Typescript and you're all good
|
# ? Sep 18, 2017 00:55 |
|
fleshweasel posted:Replace JavaScript with Typescript and you're all good
|
# ? Sep 18, 2017 00:58 |
|
Athas posted:This notion of abstracting over the practical fact that all programs are split into files is a relic of older languages, I think. Personally I can't wait until all software is written in a format somewhere between pdf files and swf
|
# ? Sep 18, 2017 02:41 |
|
modern ecmascript hits a good sweet spot in a python-like without being too python but then they made it go waaaaaaay too far so i dont tend to use any of the super modern stuff
|
# ? Sep 18, 2017 02:56 |
|
ml does not get to own the term “module system” just because they started out thinking about modularity before getting distracted designing a generics system it’s an interesting feature but it doesn’t really even try to address the top-level issues with organizing code into reusable libraries
|
# ? Sep 18, 2017 04:55 |
|
Athas posted:pairing an arbitrary regex frontend to an arbitrary regex backend, so you can get the syntax and operational behaviour you want this seems like a bad idea
|
# ? Sep 18, 2017 07:33 |
|
Powaqoatse posted:this seems like a bad idea wouldn't it just amount to "write a dsl that compiles to standard regexes"? not particularly dangerous imo kinda narrow in appeal because most people who want to write regexes will have had to learn standard syntax anyway (same reason alternative syntaxes for SQL never caught up). but i could see some uses like eg enabling static type checking
|
# ? Sep 18, 2017 08:07 |
|
Sapozhnik posted:God help me and my deepening case of brain worms but I am actually starting to like JavaScript. Triple equals really seems to solve a lot of its worst bullshit. and things like destructuring and async/await are very hard to do without once you get used to them
|
# ? Sep 18, 2017 08:11 |
|
NihilCredo posted:wouldn't it just amount to "write a dsl that compiles to standard regexes"? not particularly dangerous imo just seems like yet another way to make your code unreadable I mean what gain could ever justify that?
|
# ? Sep 18, 2017 09:15 |
|
As someone who habitually tries to use regexps in vim/grep/sed/random webapp search forms, I think "standard regexp syntax" sounds like a splendid idea.
|
# ? Sep 18, 2017 09:48 |
|
the standard is PCRE
|
# ? Sep 18, 2017 10:33 |
|
Powaqoatse posted:just seems like yet another way to make your code unreadable like i said, static type checking is one that comes to mind. have the compiler guarantee that your regex is actually valid is a pretty big deal. not coincidentally it's pretty much the only defensible reason for people bother with stuff like LINQ-to-SQL and other such leaky abstractions instead of writing straight SQL now, that doesn't necessarily require an alternative syntax, but having one (a la VerbalExpressions) means you can implement it as a simple library instead of requiring the compiler to explicitly interact with a regex parser. (you also get autocomplete support and become readable to people who don't speak regex, but like I said I doubt that's a significant audience) or, if you have fancier tools like dependent typing or type providers, you can also have the compiler automatically infer your regex captures at compile time, which is real neat
|
# ? Sep 18, 2017 11:00 |
|
go would be sw8 for say a microcontroller but it has a GC built-in and that's not cool also RAII owns bones for my dumbass Arduino projects.
|
# ? Sep 18, 2017 11:11 |
|
Malcolm XML posted:go would be sw8 for say a microcontroller but it has a GC built-in and that's not cool Hence my current rust-arduino library project
|
# ? Sep 18, 2017 11:29 |
|
gonadic io posted:Hence my current rust-arduino library project i just read through part of this today: https://japaric.github.io/discovery/README.html and then i ordered the reccomended hardware stuff on taobao for like $20 and im gonna try it out. i've never really done any embedded stuff before
|
# ? Sep 18, 2017 12:23 |
|
fart simpson posted:i just read through part of this today: https://japaric.github.io/discovery/README.html Aww yeah! I hadn't either before I started something similar. The two main things are 1) lots of writing to specific memory addresses that you have to calculate from various parts of documentation, and 2) no heap or dynamic allocation which rust supports via no_std
|
# ? Sep 18, 2017 12:26 |
|
my work firewall is either too stupid or too wise:
|
# ? Sep 18, 2017 13:45 |
|
NihilCredo posted:my work firewall is either too stupid or too wise: haskell is porn for nerds for whom concepts like bijection & tail recursion make all turgid --WONTFIX
|
# ? Sep 18, 2017 14:01 |
|
i was reading this paper about WebAssembly where it says "Adding threads and a memory model is the subject of ongoing work beyond the scope of this paper." this seems kind of odd from the standpoint of the vibe i get from the rest of the paper...namely that WebAssembly is the best-designed and best-planned thing ever conceived. my naive thought is that going back and adding threads later will lead to compromises in their design. am i wrong?
|
# ? Sep 18, 2017 15:18 |
|
Retrofitting threads is hard for a system where it was not originally conceived (lol python), but it is not too bad if you built the original design such that it could eventually be extended. From what I know of WebAssembly, there is not really a reason why it would be particularly hard to add.
|
# ? Sep 18, 2017 15:33 |
|
Powaqoatse posted:the standard is PCRE unironically this
|
# ? Sep 18, 2017 17:02 |
|
MALE SHOEGAZE posted:my favorite go quirk is that imports are file-scoped. so if you import fmt in one file you'll need to reimport it in another file in the same package. IDK about the state part but this isn't really a quirk? It's the same for Java, for instance. I'm guessing that maybe Java just has a culture of importing specific classes out of a package instead of *, whereas Go doesn't? Otherwise, I'm not sure how these are different e: or maybe the "namespace collision" part is just because in Java everything is forced into a class, so there's less opportunity to collide?
|
# ? Sep 18, 2017 18:48 |
|
Powaqoatse posted:the standard is PCRE re2 is the only one i would recommend anything new to rely on, a lot of janky things in pcre (inheritance from perl), and the usual catastrophic performance issues which people love to forget about the fact that neither has much of a specification is unfortunate also, but re2 at least limits the scope a lot in a rather sensible way
|
# ? Sep 18, 2017 19:27 |
|
Cybernetic Vermin posted:the usual catastrophic performance issues which people love to forget about oh no, this toy case with a billion back references takes minutes, who could live under these conditions
|
# ? Sep 18, 2017 19:42 |
|
crazypenguin posted:IDK about the state part but this isn't really a quirk? It's the same for Java, for instance. Java packages and golang packages are very different so the scoping rules arent really comparable. One major difference is that functions and variables are allowed at the top level of a golang package. also, packages will be initialized once at runtime, and have mutable state, so it's more accurate to think of them as objects (this is why you can't import a single identifier from a go package -- that identifier is tied implicitly to the package because it might rely on the state of the package, so it doesn't make sense to be able to import a single identifier). the end result of this is that go makes it very difficult to organize your code, which is especially an issue in a language that has no generics and demands that you have lots of functions named add_int32, add_int64, etc. add issues with cyclic dependencies on top of this, and you have a real poo poo show. at least in my experience. i was clearly not arranging my go code properly because i had lots of problems. also i could be wrong on any of this. it's been quite a while since i've written any go. DONT THREAD ON ME fucked around with this message at 19:52 on Sep 18, 2017 |
# ? Sep 18, 2017 19:49 |
JawnV6 posted:oh no, this toy case with a billion back references takes minutes, who could live under these conditions the beast with a billion back references
|
|
# ? Sep 18, 2017 19:51 |
|
JawnV6 posted:oh no, this toy case with a billion back references takes minutes, who could live under these conditions pcre like most implementations in perls footsteps does backtracking search to match the regex, without back references it is still exponential time in the worst case. the toy example is just ^(a*)*$ which on the string aa....ab will make exponentially many match attempts, but it is non-trivial to avoid cases where multiple ways of matching show up. for example any union (E|F)* will take O(n^2) to match if there exists any string in the intersection between the languages matched by E and F re2 employs a table parsing technique which avoid this issue. perl itself has some flag these days to store additional info to mostly avoid these situations, but that is then more expensive, not least incurring non-trivial additional memory usage, than the re2 approach Cybernetic Vermin fucked around with this message at 20:32 on Sep 18, 2017 |
# ? Sep 18, 2017 20:29 |
|
my favorite regex syntax is the equivalent dfa diagram
|
# ? Sep 19, 2017 02:00 |
|
Cybernetic Vermin posted:pcre like most implementations in perls footsteps does backtracking search to match the regex, without back references it is still exponential time in the worst case. the toy example is just ^(a*)*$ which on the string aa....ab will make exponentially many match attempts, but it is non-trivial to avoid cases where multiple ways of matching show up. for example any union (E|F)* will take O(n^2) to match if there exists any string in the intersection between the languages matched by E and F rob pike: "Rule 3. Fancy algorithms are slow when n is small, and n is usually small. Fancy algorithms have big constants. Until you know that n is frequently going to be big, don't get fancy. (Even if n does get big, use Rule 2 first.)"
|
# ? Sep 19, 2017 02:25 |
|
that quote is from back when rob pike was sane
|
# ? Sep 19, 2017 02:30 |
|
VikingofRock posted:the beast with a billion back references
|
# ? Sep 19, 2017 02:34 |
|
Cybernetic Vermin posted:pcre like most implementations in perls footsteps does backtracking search to match the regex, without back references it is still exponential time in the worst case. the toy example is just ^(a*)*$ which on the string aa....ab will make exponentially many match attempts, but it is non-trivial to avoid cases where multiple ways of matching show up. for example any union (E|F)* will take O(n^2) to match if there exists any string in the intersection between the languages matched by E and F also yeah ive never had to put a regex in some perf critical CDN control plane but for mashing text from a data sheet into friendly #def's with vim/sed they're needs-suiting as heck and ive never had to care if it was exponentially matching MODULE_ or not
|
# ? Sep 19, 2017 03:31 |
|
|
# ? May 17, 2024 02:53 |
|
JawnV6 posted:also yeah ive never had to put a regex in some perf critical CDN control plane but for mashing text from a data sheet into friendly #def's with vim/sed they're needs-suiting as heck and ive never had to care if it was exponentially matching MODULE_ or not The thing basically is that with properly implemented regexes, you can mostly trivially* expose regex-supporting search field to public without opening yourself to easy denial-of-service attack. * If you allow PCRE notation, you will need to somewhat limit the x in a{1, x}. tef posted:rob pike: "Rule 3. Fancy algorithms are slow when n is small, and n is usually small. Fancy algorithms have big constants. Until you know that n is frequently going to be big, don't get fancy. (Even if n does get big, use Rule 2 first.)" RE2 actually uses older and simpler algorithm for the core functionality than PCRE, most of its fanciness is SW engineering (arena allocators, on-the-fly NFA-DFA conversion, etc) and figuring out how to break down most of PCRE back into proper finita automata.
|
# ? Sep 19, 2017 06:44 |