ekuber,
@ekuber@hachyderm.io avatar

Somewhat cursed #RustLang idea: "attributes at a distance"

#![attr(target = crate::foo::Bar)]

mod foo {  
 struct Bar;  
}  

What would you use this for?

muvlon,
@muvlon@hachyderm.io avatar

@ekuber Why of course to derive traits on foreign types 😈

Life's too short for coherence!

ekuber,
@ekuber@hachyderm.io avatar

@muvlon I have been accused of being incoherent in the past 😋

jhpratt,
@jhpratt@mastodon.social avatar

@ekuber Allowing something deprecated is an obvious situation to me

ekuber,
@ekuber@hachyderm.io avatar

@jhpratt you're thinking an "allow in this project the use of this explicit deprecated item"? That seems like a good argument for lint arguments.

jhpratt,
@jhpratt@mastodon.social avatar

@ekuber Ah, I misunderstood what was being suggested. I have no idea why you'd want that 😅

ekuber,
@ekuber@hachyderm.io avatar

@jhpratt 😄
None of the reasons that come to mind are non-horrifying

ekuber,
@ekuber@hachyderm.io avatar

The idea came in the context of lints, after looking at how C# deals with them, the following is expressible there:

#![allow("unused", target = crate::foo::Bar)]

mod foo {  
 struct Bar;  
}  
mo8it,
@mo8it@fosstodon.org avatar

@ekuber It will lead to a lot of confusion for no significant win. Effects that are very hard to track back.

ekuber,
@ekuber@hachyderm.io avatar

@mo8it be aware that with proc-macros and build files you can commit multiple non-locality crimes today 😬

  • All
  • Subscribed
  • Moderated
  • Favorites
  • rust
  • DreamBathrooms
  • ngwrru68w68
  • modclub
  • magazineikmin
  • thenastyranch
  • rosin
  • khanakhh
  • InstantRegret
  • Youngstown
  • slotface
  • Durango
  • kavyap
  • mdbf
  • GTA5RPClips
  • megavids
  • tacticalgear
  • normalnudes
  • tester
  • osvaldo12
  • everett
  • cubers
  • ethstaker
  • anitta
  • Leos
  • cisconetworking
  • provamag3
  • JUstTest
  • lostlight
  • All magazines