New around here? Register your SA Forums Account here!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
FlapYoJacks
Feb 12, 2009

by vyelkin
If you set up your build system correctly, Boost is fine if you use it very sparingly and with libraries that are smaller.

It can slow your compile down to a crawl if used incorrectly though.

Adbot
ADBOT LOVES YOU

Finster Dexter
Oct 20, 2014

Beyond is Finster's mad vision of Earth transformed.
I know I'm lttp for js spa talk, but at the risk of shaggaring I have the horrible opinion that asp.net core mvc with plain ol' razor views is the pinnacle of webdev right now. I want server-side rendering and jfc get nodejs away from me eww gross

The worst thing MS dotnet team has done in a while, is rolling all the frontend js poo poo into the default templates.

The age of webassm can't get here fast enough.

brap
Aug 23, 2004

Grimey Drawer

VikingofRock posted:

So I generally think boost libraries (with some notable exceptions) are pretty usable, if a little over-engineered and quirky. But boost::filesystem in contrast seems really under-engineered and full of surprises. For example, I'm trying to write a function which copies a few directories recursively. It seems like the copy itself should be as simple as:

C++ code:
fs::copy(source, destination);
But that runs into this wild segfault. Okay though, that seems like it might be apple's fault, so we won't hold it against boost::filesystem. And there's a workaround:

C++ code:
fs::copy(source, destination, ec);
if (ec) {
    throw std::runtime_error(std::string("Error copying ")
    + source.native() + " to "
    + destination.native() + ": "
    + ec.message());
}
Except that doesn't do what you think it does. When copying directories (like source and destination), boost::filesystem doesn't actually recursively copy the directory (like you would expect), but instead just creates a new directory at the destination with the same attributes as the source directory.

...Fine, we can work around that again.

C++ code:
for (auto& entry: fs::recursive_directory_iterator(source)) {
    auto relative_dest = entry
        .path()
        .lexically_relative(source)
        .lexically_normal();
    auto absolute_dest = destination / relative_dest;
    fs::copy(entry.path(), absolute_dest, ec);
    if (ec) {
        throw std::runtime_error(std::string("Error copying ")
        + source.native() + " to "
        + destination.native() + ": "
        + ec.message());
    }
}
Why make such a simple function so complicated?

(and no, I can't use std::filesystem from c++17, since it's been an uphill struggle making sure that I can count on c++11 being present on all the machines I want to run this on)

lol they overloaded the / operator for joining paths?

Shaggar
Apr 26, 2006

akadajet posted:

cjs: trying to convince web developers they shouldn't send 10-20 megs of json documents to the web browser and then build a full text index off of that instead of implementing server side search.

lol web "developers" are the worst. client side code was the biggest mistake.

Hunter2 Thompson
Feb 3, 2005

Ramrod XTreme

Shaggar posted:

lol [...] code was the biggest mistake.

Phobeste
Apr 9, 2006

never, like, count out Touchdown Tom, man

prisoner of waffles posted:

If a boost library could provide a "perfect granular control of everything" API but also a "common use cases, do what I mean" API, there's an abnormally good chance they'll leave the latter as an exercise for the library consumer

e: blah blah blah burden of trying to be header-only

yeah, it's annoying. also boost fs isn't even header only

Soricidus
Oct 20, 2010
freedom-hating statist shill

Finster Dexter posted:

I know I'm lttp for js spa talk, but at the risk of shaggaring I have the horrible opinion that asp.net core mvc with plain ol' razor views is the pinnacle of webdev right now. I want server-side rendering and jfc get nodejs away from me eww gross

The worst thing MS dotnet team has done in a while, is rolling all the frontend js poo poo into the default templates.

The age of webassm can't get here fast enough.

so you’ll be able to write the same lovely spas using equally lovely frameworks ...... but with all the joys of c++ on top?

Finster Dexter
Oct 20, 2014

Beyond is Finster's mad vision of Earth transformed.

Soricidus posted:

so you’ll be able to write the same lovely spas using equally lovely frameworks ...... but with all the joys of c++ on top?

what... no... there would be no spa. And C++? what are you smoking? C#, baby!


mystes
May 31, 2006

Soricidus posted:

so you’ll be able to write the same lovely spas using equally lovely frameworks ...... but with all the joys of c++ on top?
People will probably try to go even further and render directly to webgl or something horrible like that.

gonadic io
Feb 16, 2011

>>=

mystes posted:

People will probably try to go even further and render directly to webgl or something horrible like that.

webasm + webgl = emulate an entire computer in your browser

Corla Plankun
May 8, 2007

improve the lives of everyone
i wish they'd emulate a competent dev team and build a fucken native app

aardvaard
Mar 4, 2013

you belong in the bog of eternal stench

the problem is web, not js. you can write your frontend code in whatever language you want and it'll still be unmaintainable garbage because it's web dev and that's just how it be.

champagne posting
Apr 5, 2006

YOU ARE A BRAIN
IN A BUNKER


i want to learn some c++. is there an ide that’s the ide for this purpose?

HoboMan
Nov 4, 2010

Finster Dexter posted:

I know I'm lttp for js spa talk, but at the risk of shaggaring I have the horrible opinion that asp.net core mvc with plain ol' razor views is the pinnacle of webdev right now. I want server-side rendering and jfc get nodejs away from me eww gross

The worst thing MS dotnet team has done in a while, is rolling all the frontend js poo poo into the default templates.

The age of webassm can't get here fast enough.

i was considering posting this but i was afraid of it being too shaggar of an opinion

Soricidus
Oct 20, 2010
freedom-hating statist shill

Boiled Water posted:

i want to learn some c++. is there an ide that’s the ide for this purpose?

yes, but there are differing opinions on which one it is

prisoner of waffles
May 8, 2007

Ah! well a-day! what evil looks
Had I from old and young!
Instead of the cross, the fishmech
About my neck was hung.

Soricidus posted:

yes, but there are differing opinions on which one it is

what are the good clang tooling backed options?

Finster Dexter
Oct 20, 2014

Beyond is Finster's mad vision of Earth transformed.

HoboMan posted:

i was considering posting this but i was afraid of it being too shaggar of an opinion

My recent interactions with js dev have killed the non-shaggar parts of my brain.

Star War Sex Parrot
Oct 2, 2003

prisoner of waffles posted:

what are the good clang tooling backed options?
CLion's integrated code analysis by clang-tidy is nice, though it chugs on analyzing complex projects that bring in like TBB or Boost (it might have improved a bit with the 2018 releases). the UIs they wrap around LLDB/GDB and AddressSanitizer are nice too

I found it rather invaluable for quickly getting up to speed on larger C++ codebases

Nomnom Cookie
Aug 30, 2009



I like clion it’s IntelliJ for c++. cmake only tho

Nomnom Cookie
Aug 30, 2009



Star War Sex Parrot posted:

CLion's integrated code analysis by clang-tidy is nice, though it chugs on analyzing complex projects that bring in like TBB or Boost (it might have improved a bit with the 2018 releases). the UIs they wrap around LLDB/GDB and AddressSanitizer are nice too

I have used clion with boost successfully. only a little bit of boost tho

Shaggar
Apr 26, 2006

Finster Dexter posted:

My recent interactions with js dev have killed the non-shaggar parts of my brain.

feels good

Main Paineframe
Oct 27, 2010

aardvaard posted:

the problem is web, not js. you can write your frontend code in whatever language you want and it'll still be unmaintainable garbage because it's web dev and that's just how it be.

too bad it's basically the only reasonable way to write something that works cross-platform these days

redleader
Aug 18, 2005

Engage according to operational parameters

brap posted:

lol they overloaded the / operator for joining paths?

yeah, that's some terrible cutesy poo poo

Jabor
Jul 16, 2010

#1 Loser at SpaceChem
c++ operator overloading is some horribly abused poo poo

and it started right at the beginning when some genius decided that the left and right shift operators would be perfect to use for i/o

30 TO 50 FERAL HOG
Mar 2, 2005



okay its me the terrible programmer. im writing some javascript (Actually CoffeeScript but whatever) app and im getting a little frustrated with promises, at least in a particular situation

since im on CoffeeScript 1.x, I dont have async/await available to me. otherwise I could do this

code:
results = []

for item in items
	temp = {}
	temp["a"] = await someAsyncFunction(item)
	temp["b"] = item.someProperty 
	results.push temp
and all would be well in the world. what ive resorted to is this..... thing

code:
promises = []
results = []

for item in items
	temp = {}
	tempPromise = someAsyncFunction(item)
	promises.push tempPromise
	temp["a"] = tempPromise
	temp["b"] = item.someProperty 
	results.push temp

Promise.all(promises)
which works, I guess, the object assigned to temp["a"] is a promise and not the actual result of that promise, but I can at least get to it in some way

VikingofRock
Aug 24, 2008




brap posted:

lol they overloaded the / operator for joining paths?

I'm actually fine with that. In the context of paths, it's pretty clear that / doesn't refer to division, so overloading it adds convenience without hurting readability (personally I'd say it improves readability). Also I think overloading / for paths is pretty common in languages with operator overloading; for example python's pathlib does it too.

bob dobbs is dead
Oct 8, 2017

I love peeps
Nap Ghost

BIGFOOT EROTICA posted:

okay its me the terrible programmer. im writing some javascript (Actually CoffeeScript but whatever

done, we'll believe you're a terrible programmer now. you can get the statuette when you get out, the little id card is in the mail

30 TO 50 FERAL HOG
Mar 2, 2005



bob dobbs is dead posted:

done, we'll believe you're a terrible programmer now. you can get the statuette when you get out, the little id card is in the mail

namaste

Nomnom Cookie
Aug 30, 2009



Jabor posted:

c++ operator overloading is some horribly abused poo poo

and it started right at the beginning when some genius decided that the left and right shift operators would be perfect to use for i/o

at least c++ doesn't let you make new operators like haskell and scala

(fart <+>>> butt <<<+> poop) _+_ (boners <^> otherButt)

Nomnom Cookie
Aug 30, 2009



VikingofRock posted:

I'm actually fine with that. In the context of paths, it's pretty clear that / doesn't refer to division, so overloading it adds convenience without hurting readability (personally I'd say it improves readability). Also I think overloading / for paths is pretty common in languages with operator overloading; for example python's pathlib does it too.

well you picked the right thread for this post at least

gonadic io
Feb 16, 2011

>>=

VikingofRock posted:

I'm actually fine with that. In the context of paths, it's pretty clear that / doesn't refer to division, so overloading it adds convenience without hurting readability (personally I'd say it improves readability). Also I think overloading / for paths is pretty common in languages with operator overloading; for example python's pathlib does it too.

Scala too but it really annoys me because it's infix so you ha e to do (file / "butt's").thingy() every loving time

Kevin Mitnick P.E. posted:

at least c++ doesn't let you make new operators like haskell and scala

(fart <+>>> butt <<<+> poop) _+_ (boners <^> otherButt)

Agreedo God drat that poo poo is painful

animist
Aug 28, 2018
that's why I like J. most of its horrible linenoise operators are language builtins.

code:

quicksort=: (($:@(<#[), (=#[), $:@(>#[)) ({~ ?@#)) ^: (1<#)

(well, technically they might be in the standard library. Still, it's way more brazen than Haskell.)

mystes
May 31, 2006

animist posted:

that's why I like J. most of its horrible linenoise operators are language builtins.

code:
quicksort=: (($:@(<#[), (=#[), $:@(>#[)) ({~ ?@#)) ^: (1<#)
(well, technically they might be in the standard library. Still, it's way more brazen than Haskell.)
J, the answer to the question "how can we make APL less readable?"

eschaton
Mar 7, 2007

Don't you just hate when you wind up in a store with people who are in a socioeconomic class that is pretty obviously about two levels lower than your own?

the talent deficit posted:

people write SPAs in complicated frameworks because users want mobile app like features, complexity and performance in the browser.

no they don’t, users want mobile apps and some developers and management think they can cheat and make web pages pretend to be mobile apps

akadajet
Sep 14, 2003

eschaton posted:

no they don’t, users want mobile apps and some developers and management think they can cheat and make web pages pretend to be mobile apps

just wrap it in a webview. bam, instant mobile app!

Chalks
Sep 30, 2009

eschaton posted:

no they don’t, users want mobile apps and some developers and management think they can cheat and make web pages pretend to be mobile apps

People generally don't want to install random poo poo that could just be on a web page.

Soricidus
Oct 20, 2010
freedom-hating statist shill

Chalks posted:

People generally don't want to install random poo poo that could just be on a web page.

agreed, few things are as annoying as web pages that detect you’re on a phone and cover half the page with a GET OUR APP!!! banner

mystes
May 31, 2006

Probably both are true? At the very least, if users are going to go through the trouble of installing an app, it better not just be a webview displaying the web page.

Chalks
Sep 30, 2009

mystes posted:

Probably both are true? At the very least, if users are going to go through the trouble of installing an app, it better not just be a webview displaying the web page.

Usually when the question of apps comes up, it's because the person involved in the sales process who doesn't know what the gently caress they're talking about has been told that you must have an app and no telling them that a webpage will work just fine will satisfy them.

If you can answer "yes" to the "do you have an app?" question they'll be happy. No requirements for what that app should do or indeed any idea of why they demanded it. Slap the web page into an app, watch as nobody downloads it but still be able to answer yes to the app question during the sales process.

Adbot
ADBOT LOVES YOU

suffix
Jul 27, 2013

Wheeee!

VikingofRock posted:

I'm actually fine with that. In the context of paths, it's pretty clear that / doesn't refer to division, so overloading it adds convenience without hurting readability (personally I'd say it improves readability). Also I think overloading / for paths is pretty common in languages with operator overloading; for example python's pathlib does it too.

it's terrible in python as well, maybe worse since python code tends to be less overload-crazy in general



your non-async version is technically 'better' here because it can run all the someAsyncFunction calls in parallel, which may or may not matter more than code clarity
i would expect something maybe like
code:
var promises = items.map(item => someAsyncFunction(item)
    .then(result => ({a: result, b: item.someProperty})));
return Promise.all(promises);

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply