Error: no property "someFont" for type int

Marco de Wild via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Nov 11 08:40:08 PST 2015


> This is not D. It should be giving you a compiler error. How 
> are you compiling? Or did you type 'using' in the post by 
> mistake? Anyway, what you want is:
>
> import style;
>
I indeed made a typo while typing the post (and also on various 
occasions while writing the program, but compiler errors fixed 
that). That's what you get for using C# at work.
>>
>> In style.d:
>> module style;
>> (...)
>> public static class Style
>> {
>
> 'static class' has no meaning in module scope, only for inner 
> classes. It's not the cause of your problem though.

Thanks for the heads up :) I figured it was about time to dust my 
D-skills.

>
> The error is likley because of a symbol conflict. Assuming that 
> Text is from the module dsfml.text.graphics, it has an enum 
> type named Style. There's an unfortunate issue in D that allows 
> both of the following to compile:
>
> auto e1 = Text.Style.Regular;
> _text.Style.Regular;
>
> The latter should not be allowed, IMO, but it is what it is. So 
> in your case, accessing your Style class in the scope of 
> with(_text) is causing the compiler to find _text.Style. The 
> solution is to use the FQN (Fully Qualified Name) on your Style 
> inside the with, i.e. style.Style, or to drop the with 
> altogether.

Dropping the with worked like a charm, thanks a lot for the fast 
reply!



More information about the Digitalmars-d-learn mailing list