|
MononcQc posted:Schemes and Lisp often toyed with the idea of alternative function-based approaches to regular expressions. One of them (SRE) had the POSIX regex:
|
# ? Aug 20, 2013 18:09 |
|
|
# ? Jun 11, 2024 15:58 |
|
MononcQc posted:Schemes and Lisp often toyed with the idea of alternative function-based approaches to regular expressions. One of them (SRE) had the POSIX regex: how is this different than using code blocks inside regular expressions?
|
# ? Aug 20, 2013 18:21 |
|
FamDav posted:i call it more powerful because it's more general and has less structure imposed on it. this can also lead to it interacting poorly with other features of the language resulting in ridiculous errors. Exactly, the power of a language feature is measured by the size of the hole it leaves in your foot.
|
# ? Aug 20, 2013 18:46 |
|
FamDav posted:<c++ feature> is a bad feature because what you really wanted was something like <thought out feature>. instead you got something that allowed you to kind of <useful thing> but also allowed you to get really weird behavior because <c++> c++ is a world where everything is possible but the price is unreasonable
|
# ? Aug 20, 2013 19:42 |
|
MononcQc posted:Schemes and Lisp often toyed with the idea of alternative function-based approaches to regular expressions. One of them (SRE) had the POSIX regex: So...parsec? Limited to regular languages?
|
# ? Aug 20, 2013 19:47 |
|
tef posted:c++ is a world where everything is possible but the price is unreasonable for a lot of applications, this is a better starting point than a language that comes pre-restricted for the sake of convenience
|
# ? Aug 20, 2013 19:53 |
|
Shaggar posted:The fact that the language convention tends towards readability is one of its strengths. also the auto complete literally makes it faster than an untyped shortcut that the autocomplete cant figure out for you. Shaggar posted:if you get mad about verbosity you're the biggest whiney babby idiot. lol at "verbosity == readability" Shaggar posted:if lambdas ever become useful im sure they'll be added to java lol @ this gucci void main posted:weve hit peak shaggar
|
# ? Aug 20, 2013 20:13 |
|
coffeetable posted:it's the sierpinski gasket. probably seen it on the cover of some textbook or other also lollin' at people who browse w/avs off
|
# ? Aug 20, 2013 20:13 |
|
PleasingFungus posted:lol at "verbosity == readability" http://en.wikipedia.org/wiki/Trimming_%28computer_programming%29#Usage
|
# ? Aug 20, 2013 20:16 |
|
PleasingFungus posted:also lollin' at people who browse w/avs off ffff
|
# ? Aug 20, 2013 20:17 |
|
MononcQc posted:Schemes and Lisp often toyed with the idea of alternative function-based approaches to regular expressions. One of them (SRE) had the POSIX regex: well basically this is what happens when you want to make regex not poo poo: you turn it into an actual parser with multiple independently defined grammar rules that can be reused, and with the right language / library writing such rules can be made really nice and easy so why even bother with regex this is typically the type of things that ~the power of C++~ is very good at. using templates and operators overloading you can have something very similar to that scheme thing above that let you define and compose parsing grammar rules like this: code:
boost::spirit offers just such a parsing library
|
# ? Aug 20, 2013 20:23 |
|
Malcolm XML posted:So...parsec?
|
# ? Aug 20, 2013 20:35 |
|
Zlodo posted:regex are gross and only useful to sift through the dejections of another program to find some data sometimes regexes just own.
|
# ? Aug 20, 2013 20:43 |
|
like always the haskell version is infinitely better
|
# ? Aug 20, 2013 20:53 |
|
PleasingFungus posted:lol at "verbosity == readability" in the case of java the "verbosity" idiots are whining about is readability. Having class and variable names that describe what they are instead of p-lang style Python code:
|
# ? Aug 20, 2013 20:56 |
|
ah, i see. so int ____xXXx4; is better than var ____xXXx4;. gotcha.
|
# ? Aug 20, 2013 21:10 |
|
uG posted:how is this different than using code blocks inside regular expressions? Not sure given I haven't used or seen code blocks inside regexes in any significant manner. My guess is that code inside regexes is about changing or augmenting the regex execution while the scheme approach is to treat the regex as a data structure that is more powerful than a string -- it just turns out that lisps consider data to be code, so you can both run code and represent the regex as sequences of possibly nested data structures that can be composed together. Malcolm XML posted:So...parsec? Limited to regular languages? Possibly. Not that it matters given the context of the original question was "is there a language where a nice pile of regex isn't going to look like that, though?"
|
# ? Aug 20, 2013 21:12 |
|
Suspicious Dish posted:ah, i see. so int ____xXXx4; is better than var ____xXXx4;. gotcha. yes but int ____bonerCount is even better and then int bonerCount would be best.
|
# ? Aug 20, 2013 21:13 |
|
wouldnt it be BONER_COUNT?
|
# ? Aug 20, 2013 21:15 |
|
not unless its a constant which it wouldn't be unless maybe u have ed?
|
# ? Aug 20, 2013 21:18 |
|
MononcQc posted:Not sure given I haven't used or seen code blocks inside regexes in any significant manner. My guess is that code inside regexes is about changing or augmenting the regex execution while the scheme approach is to treat the regex as a data structure that is more powerful than a string -- it just turns out that lisps consider data to be code, so you can both run code and represent the regex as sequences of possibly nested data structures that can be composed together. is your question "is there a language where the default library implementation of regex is parser combinators?" becuase i'd say its between maybe and no. but like all languages have parser combinator libraries
|
# ? Aug 20, 2013 21:18 |
|
also you know how like sometimes people are like "programmers are dumb they cant understand this language feature" well add post/pre increment to this http://forums.somethingawful.com/showthread.php?threadid=3376083&userid=0&perpage=40&pagenumber=153#post418468778
|
# ? Aug 20, 2013 21:23 |
|
Shaggar posted:not unless its a constant which it wouldn't be unless maybe u have ed? yospos bitch
|
# ? Aug 20, 2013 21:25 |
|
FamDav posted:also you know how like sometimes people are like "programmers are dumb they cant understand this language feature" isnt that ub?
|
# ? Aug 20, 2013 21:31 |
|
it takes awhile but someone eventually says that yes
|
# ? Aug 20, 2013 21:36 |
|
gently caress people who try to pull dumb poo poo with pre/post-increment. the fanciest thing you're allowed to do with them is traverse an array with a pointer in one step, i.e. foo = *(i++). anything more complex than that is (a) unreadable, (b) probably undefined and (c) makes you look like a douche.
|
# ? Aug 20, 2013 22:20 |
|
FamDav posted:also you know how like sometimes people are like "programmers are dumb they cant understand this language feature" if i got this in an interview i would almost certainly tell the interviewer to blow it out their rear end which is really the only correct answer
|
# ? Aug 20, 2013 22:23 |
|
PleasingFungus posted:gently caress people who try to pull dumb poo poo with pre/post-increment. the fanciest thing you're allowed to do with them is traverse an array with a pointer in one step, i.e. foo = *(i++). anything more complex than that is (a) unreadable, (b) probably undefined and (c) makes you look like a douche. but but but my artisanal bespoke handcrafted shitcode!!!
|
# ? Aug 20, 2013 22:23 |
|
Zlodo posted:regex are gross and only useful to sift through the dejections of another program to find some data if you never need to write regex your job is so boring that someone has already gotten to the data you need and carefully digested + regurgitated it so your babby self can handle it
|
# ? Aug 20, 2013 22:25 |
|
lmao at the idea that a factor to identify a fun job is having regexes as a necessity
|
# ? Aug 20, 2013 22:26 |
|
PleasingFungus posted:gently caress people who try to pull dumb poo poo with pre/post-increment. the fanciest thing you're allowed to do with them is traverse an array with a pointer in one step, i.e. foo = *(i++). anything more complex than that is (a) unreadable, (b) probably undefined and (c) makes you look like a douche. Similar in vein is using the it to fill in prepared statements in jdbc code. Java code:
|
# ? Aug 20, 2013 22:32 |
|
why does that c code even compile? are c compilers too lazy to throw an error for that case or is there legit reason? also re: regexs. if your regex has multiple compnents what's wrong with creating string patterns for each component and +ing them when you compile regex object??
|
# ? Aug 20, 2013 22:37 |
|
Hard NOP Life posted:Similar in vein is using the it to fill in prepared statements in jdbc code. ugghhhhhhh
|
# ? Aug 20, 2013 22:38 |
|
FamDav posted:also you know how like sometimes people are like "programmers are dumb they cant understand this language feature" jesus christ i read farther in that thread, and there's someone about to graduate with a 4.0 in cs who doesn't know what a hashmap is, with the excuse "i only know java"
|
# ? Aug 20, 2013 22:41 |
|
Shinku ABOOKEN posted:why does that c code even compile? are c compilers too lazy to throw an error for that case or is there legit reason? it's not illegal, it's just undefined that these are distinct concepts, well
|
# ? Aug 20, 2013 22:47 |
|
Shinku ABOOKEN posted:why does that c code even compile? are c compilers too lazy to throw an error for that case or is there legit reason? compiler maintainers feel a need to support "legacy code" - if it 'works' then people get mad when the new compiler version breaks it, even if it should never have worked in the first place -pedantic --Wall exist for a reason but sadly aren't on by default
|
# ? Aug 20, 2013 23:03 |
|
Cocoa Crispies posted:it's not illegal, it's just undefined PleasingFungus posted:compiler maintainers feel a need to support "legacy code" - if it 'works' then people get mad when the new compiler version breaks it, even if it should never have worked in the first place my variation on this is that certain types of behavior were left undefined to make things easier for compiler writers to optimize, or something. of course this is a bad thing
|
# ? Aug 20, 2013 23:45 |
|
JewKiller 3000 posted:jesus christ i read farther in that thread, and there's someone about to graduate with a 4.0 in cs who doesn't know what a hashmap is, with the excuse "i only know java" this person will get a job writing your medical billing software
|
# ? Aug 20, 2013 23:54 |
|
MononcQc posted:Possibly. Not that it matters given the context of the original question was "is there a language where a nice pile of regex isn't going to look like that, though?" Off the top of my head: prolog uses definite clause grammars, it's like peg but with no memorisation, but way more control over search/backtracking. icon uses a neat but somewhat weird system of generators and goal directed evaluation snobol uses pattern matching and conditional jumps a lot of languages use combinator parsing, which is basically like building a recursive descent parser from functional composition but, heh, lua has lpeg, which is a backtracking combinator library, which then a regex library is built on. it's well nice
|
# ? Aug 21, 2013 00:13 |
|
|
# ? Jun 11, 2024 15:58 |
|
JewKiller 3000 posted:jesus christ i read farther in that thread, and there's someone about to graduate with a 4.0 in cs who doesn't know what a hashmap is, with the excuse "i only know java" I'm pleasantly surprised when I meet high level CS degree holders who know what an array is. Or a variable.
|
# ? Aug 21, 2013 00:30 |