* * *

Recent Posts

Pages: [1] 2 3 ... 10
1
General / Re: Useful Oxygene Features for FPC?
« Last post by ASBzone on Today at 04:25:47 am »

3)why even the need of: procedure/function instead like method(or if u dont wanna have this OOP implication, because method is more used for OOP description) then use for instance: "routine Dowork;" or "routine getStuff: TStuff";

4) why doing this for extensions: "TExtension = Type helper for record(TRecord)" instead of: "TExtension = extension of(TMyRecord)" would actually do the same because the extensiontype is based on the type it extens obviously


This is IMO not soooo cleanly designed as I think.

Surely, you realize that when making changes to an established computer language, the entire issue of backwards compatibility needs to be taken into account?

The suggestions you offer might be comparatively cleaner to write, but as for the goal of increased popularity that you implied earlier, how do you suppose developers would react if they had to change their existing code bases to deal with this?

Also, did you give any consideration to the fact that the pros you mentioned for FPC are in part available because time hasn't been spent on some of the other items that you like elsewhere?

This is not to imply that all talk of improvement or potential new features is bad.  It is more to highlight the fact that when there is not unlimited (or even "significant") budget and time for a project, attention in one area comes at the expense of attention in other areas.    Some of the items in your current FPC "pro" list might be adversely impacted by trying to implement some of these other wishlist items...

It's not an automatic win to add them...
2
General / Re: Why should we use classes instead of records?
« Last post by lucamar on Today at 02:52:25 am »
Actually I know that classes are creating on the heap and records are creating on the stack in Object Pascal.

Hmmm... Actually that depends on quite a lot of circumstances: where you declare the classes/objects/records, how you use them, etc. For example, in this code MyRecord is *not* created in the stack.

Code: Pascal  [Select]
  1. program toto;
  2.  
  3. type
  4.   TMyRecord: packed record
  5.     Id: Integer;
  6.     Code: AnsiChar;
  7.     Description: ShortString
  8.   end;
  9.  
  10. var
  11.   MyRecord: TMyRecord;
  12.  
  13. begin
  14.   MyRecord.Id := 19654;
  15.   MyRecord.Code := 'A';
  16.   MyRecord.Description := 'An absurd do-nothing example';
  17.   WriteLn('We did do-nothing!!!');
  18. end.
  19.  

And AFAIK (which isn't much, truth be told) the same happens in C(++).

As for why we should use classes instead of records ... we shouldn't. We should use the most appropriate construct for each piece of code. No more, no less  ;D

Quote
[...] C++ programmers usually use static memory (stack) but as far as I know Object Pascal programmers usually use dynamic memory (heap).

Huh? No, not really. At least in the code bases I have seen. Both camps (try to) use the appropriate construct and let the compiler decide how memory allocation is done, but minimally large C(++) code is usually choked full of calls to functions of the alloc family ... which gets its memory from the heap. Conversely, Pascal programmers tend to divide their code into more, smaller procedures/functions, which uses (generally) the stack. So it really is a mixed kind of situation for both.

---
Edited to add the second part.
3
Cocoa / Re: TListView - OnColumnClick does not fire
« Last post by VTwin on Today at 02:20:41 am »
I checked with current trunk. Please double check my attached example (I don't use ListView), but it looks like a bug to me.

By the way, scrollbars seem not to respond to clicks above and below the pad. I was looking for an existing bug report on that.

Cheers,
VTwin
4
General / Re: Why should we use classes instead of records?
« Last post by taazz on Today at 01:33:53 am »
Hi;

Actually I know that classes are creating on the heap and records are creating on the stack in Object Pascal.
Also I know that C++ classes are creating on the stack. My question actually is why does classes being used more than records in Object Pascal? I mean C++ programmers usually use static memory (stack) but as far as I know Object Pascal programmers usually use dynamic memory (heap).

Thanks.
polymorphism requires heap even on C/C++ objects.
Are you wondering why people use classes instead of advanced records? They are more comparable.
no inheritance, no comparison.
5
General / Re: Why should we use classes instead of records?
« Last post by VTwin on Today at 01:29:51 am »
Classes are fundamental to object oriented program. Are you wondering why people use classes instead of advanced records? They are more comparable.

Edit: I guess you are asking instead about the differences in C++ and Pascal memory allocation strategies for classes? I imagine someone will jump in with an answer.
6
General / Why should we use classes instead of records?
« Last post by İbrahim on Today at 12:34:04 am »
Hi;

Actually I know that classes are creating on the heap and records are creating on the stack in Object Pascal.
Also I know that C++ classes are creating on the stack. My question actually is why does classes being used more than records in Object Pascal? I mean C++ programmers usually use static memory (stack) but as far as I know Object Pascal programmers usually use dynamic memory (heap).

Thanks.
7
Beginners / Re: Invalid Function Call
« Last post by lucamar on August 19, 2018, 11:41:24 pm »
If Owner is responsible for creating and free the object, and Parent is responsible for drawing resizing etc, [...]

Please, remember that I started with "simplifying a lot"; I was just trying to explain the basic difference between Owner and Parent for controls, namely that Owner treats with its controls as components while Parent treats with them as (visual) controls; hence the different descendancy. That's all.

Taaz is right, you shouldn't set the Parent yourself in the constructor; that's the job of the ... let's call it user code, i.e. the code which calls Create.

If anything at all, you may check if Parent is set before executing code that needs one, to prevent raising EInvalidOperation. But how then set properties whose "setter" needs a Parent? One easy way is to change only the property's (private) field and set a sentinel field that you then can use in Parent's setter to finish the process. And I'm sure you can find other ways if you set to it  :)
8
Cocoa / TListView - OnColumnClick does not fire
« Last post by MISV on August 19, 2018, 11:24:51 pm »
I seem to encounter a problem where TListView.OnColumnClick even does not fire even though the ColumnClick property is checked. Can anyone else confirm? And I will report it... (I am adding columns runtime if that matters)
9
Third party / Re: Fpcupdeluxe
« Last post by hayanninja on August 19, 2018, 10:53:57 pm »
Fpcupdeluxe uses the compiler Makefile.fpc to determine the bootstrapper versions that are allowed.

Makefile.fpc contains (among other things):
Code: Pascal  [Select]
  1. [prerules]
  2. REQUIREDVERSION=3.0.4
  3. REQUIREDVERSION2=3.0.2

From these two, it uses the highest version !
So, your observation is strange ! It should be 3.0.4 !!
However, if 3.0.2 is already available somehow, it will be used due to the fact that it is allowed.
Version 3.0.5 will never be used.

Actually, given your explanation here, it makes perfect sense that 3.0.2 was used. At the time, I had 3.0.2 (FpcUpDeluxe previously downloaded it to bootstrap compiling 3.0.5) and 3.0.5 installed. Since 3.0.4 wasn't present, it used 3.0.2.

I've been trying to get 3.2.0 up and running. However, it seems that 3.2.0 won't properly compile Lazarus 1.8.5, so I need to use trunk Lazarus (hopefully that "end of source" bug is fixed by now). Except... it seems 1.8.5 won't compile properly either? But given the SVN issue, I really have no idea whether that's actually a compiler / source issue or if it's just, again, a result of SVN being a piece of crap (although TortoiseSVN does seem to think I've got valid, up-to-date copies of both the fpcsrc and Lazarus repos, fixes_3.2 and trunk respectively).
10
Beginners / Re: Invalid Function Call
« Last post by engkin on August 19, 2018, 10:06:46 pm »
@Birger52,
For a visual control, like yours, the published properties get assigned their values *after* the constructor. At the end of the process LOADED gets called. Typically you should override LOADED and deal with adding initial labels there, but only if the control does not have some already. In LOADED the parent, where you dropped your control at design time, had already been assigned.

Listen to Taazz, he is a master at this who is willing to teach if people are willing to learn.
Pages: [1] 2 3 ... 10

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus