Pharo-dev
By thread
pharo-dev@lists.pharo.org
By month
Messages by month
- ----- 2026 -----
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
July 2016
- 477 messages
Re: [Pharo-dev] lineConversion for WriteStream
by monty
If you upgrade XMLParser, the DOM file printing methods like printToFileNamed: now automatically use your OS's linebreak, and XMLWriter, which always allowed setting the linebreak, now has an option to detect your OS's linebreak and use that.
Sent:Â Thursday, May 26, 2016 at 2:20 PM
From: "Peter Uhnák" <i.uhnak(a)gmail.com>
To:Â "Pharo Development List" <pharo-dev(a)lists.pharo.org>
Subject:Â Re: [Pharo-dev] lineConversion for WriteStream
Well I was saving e.g. STON or XML file⦠but some apps outside didn't particularly like it⦠even `cat` doesn't like CR.
Anyway; this is not system-breaking problem, just annoying.
Â
Peter
Â
On Thu, May 26, 2016 at 2:50 PM, Sven Van Caekenberghe <sven(a)stfx.eu> wrote:
> On 26 May 2016, at 14:06, Peter Uhnák <i.uhnak@gmail.com[i.uhnak@gmail.com]> wrote:
>
>
>
> On Thu, May 26, 2016 at 1:40 PM, Sven Van Caekenberghe <sven@stfx.eu[sven@stfx.eu]> wrote:
>
> > On 26 May 2016, at 13:29, Peter Uhnák <i.uhnak@gmail.com[i.uhnak@gmail.com]> wrote:
> >
> > >Â In general I would say that you should write either something platform specific or you write something specific
> >
> > Except that I cannot do that because the system doesn't support neither.
> > And the fact that the default line ending is CR is just bullshit⦠it's 2016, not 1986.
>
> Yes, that CR is from days long gone ;-)
>
> > or #cr #lf or #crlf as needed, and/or make that last one a parameter (OSPlatform current lineEnding).
>
> I am piping unknown content into the file, thus the need for `lineEndConvention:` and the reason of this entire thread. So as I said, the system doesn't support it.
> I know I can use #lf or whatnot, but I am not creating the content, I am saving it.
>
> Peter
 Well, maybe I don't understand your use case, but if you do not know what is inside, why not save it as is, binary even, not doing any conversions ?
Â
July 8, 2016
Re: [Pharo-dev] Having comments for pragma?
by Tudor Girba
Hi,
Ok, great. I will play with this.
Cheers,
Doru
> On Jul 7, 2016, at 11:19 PM, Eliot Miranda <eliot.miranda(a)gmail.com> wrote:
>
> Hi Doru,
>
>> On Jun 30, 2016, at 1:08 PM, Tudor Girba <tudor(a)tudorgirba.com> wrote:
>>
>> Hi,
>>
>>> On Jun 27, 2016, at 7:55 PM, Eliot Miranda <eliot.miranda(a)gmail.com> wrote:
>>>
>>> Hi Doru,
>>>
>>> On Mon, Jun 27, 2016 at 6:36 AM, Tudor Girba <tudor(a)tudorgirba.com> wrote:
>>> Hi Eliot,
>>>
>>> I agree with most things you say (except the conclusion :)), and I think that we are talking about complementary issues.
>>>
>>> As I mentioned before, there already is a need to distinguish between a plain selector and one that is associated with pragmas. This is what you find in PragmaType in Spotter and Inspector. This is a kind of meta-object and having it adds value. I can search for pragmas âtypeâ (we can also call it a PragmaSelector), and I can distinguish between all occurrences of a pragma âtypeâ and its utilization in computation. But, the current implementation of PragmaType is a mere pseudo-meta-object, given that it has no casual connection to the runtime.
>>>
>>> What we know from Smalltalk is that the analysis model does not have to differ from the runtime one. The consequence is that every time we do see a difference, we should investigate because we might uncover a hidden need opportunity.
>>>
>>> I know the VW model, and indeed, we could have something like:
>>>
>>> MyConcept class>>myPragmaDefinition
>>> âa comment about the pragma"
>>> <pragma: #selector>
>>>
>>> However, this only deals with the definition of the pragma type not with the internal representation. There could still well be an object that encapsulates both the selector and the comment. And that object would also allow us to build tools around it. We could call it a PragmaType, PragmaDefinition, or even PragmaSelector. And we could get the Pragma to point to this type either through an inst var or through a query (I would probably prefer an instvar).
>>>
>>> Well, there already /is/ a meta-object called Pragma, and it gets instantiated when one accesses the compiled method via pragmas:
>>>
>>> (CompiledMethod allInstances detect: [:m| m pragmas size > 1]) pragmas collect: [:ea| {ea. ea class}] {{<export: true> . Pragma} . {<var: #tablePtr type: 'int *'> . Pragma}}
>>
>> Yes I know :). An instance of Pragma denotes an concrete annotation of a method. I now would like a meta-object that describes all Pragma instances having the same selector. For example, the protocol on the class side of the Pragma class is actually a query protocol that is better suited for the instance side of a PragmaDescription meta-object. For example:
>>
>> Pragma class>>allNamed: aSymbol in: aClass
>>
>> would become
>>
>> PragmaDescription>>pragmasIn: aClass
>>
>> and you would use it like:
>>
>> (PragmaDescription named: aSymbol) pragmasIn: aClass
>>
>> Creating an instance of PragmaDescription would imply searching the image for the <pragma:> definition.
>
> I like this.
>
>> I would also like to have a Flyweight pool per environment such that we always get only one instance of a PragmaDefinition per selector (like it happens with Symbols).
>
> Yes, good refinement.
>
>>> So we could add the information you want to Pragma, and have it be lazy.
>>
>> It does not quite belong to the Pragma. A comment is common to all Pragma instances, and having it duplicated at the instance level is less elegant.
>>
>> But, looking for the users (all senders of the pragma selector - the methods that use the annotation) of a Pragma would be even less inconvenient to have on the instance side of Pragma.
>>
>>
>>> The Pragma could go search for the defining class-side pragma methods and use the parser to extract the comment(s) when asked. Hence simple access to pragmas, interested only in the selectors for applying, wouldn't have their performance be impacted.
>>
>> The design sketched above would require no runtime penalty for a Pragma instance. All code that works now would work identically afterwards. We would only have one selector in Pragma to get the corresponding description:
>>
>> Pragma>>description
>> ^ PragmaDescription named: self selector
>>
>> Alternatively, we could modify the compilation to associate the PragmaDescription in an inst var of a Pragma instance. So, CompiledMethod>>pragmas would always return instances of Pragmas with a PragmaDefinition inst var.
>>
>> I think I would start with the lazy lookup first, and this would disturb nothing from the current behavior.
>
> Sounds like a reasonable plan.
>
>>
>>
>>> I think that this proposition does not remove from the simplicity of the implementation at all, but allows the new needs to be accommodated nicely. The alternative is to not do anything, in which case we will continue to have an analysis-only-pseudo-meta-object which is not nice at all. I do not think we should jump on this lightly, but I do think we should have a critical look and evaluate the options.
>>>
>>> This pseudo-meta-object (Pragma) can sty ill be causally connected, in the same way that a MethodReference can be causally connected. The causation is things like "remove", "recompile", but that's dubious. It's essentially a read-only relationship; one wants to be able to locate the method from the pragma, but changing the method from the pragma isn't necessarily a good idea. Would you agree that convenience methods like "remove" on MethodReference are a bad idea and one should stick to the removeSelector: protocol on Behavior and ClassDescription?
>>>
>>>
>>> What do you think?
>>>
>>> Have I and enough coffee to scramble my thoughts might be a more pertinent question ;-)
>>
>> :)
>>
>> Cheers,
>> Doru
>>
>>
>>>
>>> Cheers,
>>> Doru
>>>
>>>
>>>> On Jun 27, 2016, at 2:39 PM, Eliot Miranda <eliot.miranda(a)gmail.com> wrote:
>>>>
>>>> Hi Doru,
>>>>
>>>>> On Jun 27, 2016, at 3:52 AM, Tudor Girba <tudor(a)tudorgirba.com> wrote:
>>>>>
>>>>> Hi,
>>>>>
>>>>> The CompiledMethod already has a way to retrieve Pragma instances:
>>>>>
>>>>> CompiledMethod>>pragmas.
>>>>>
>>>>> However, the Pragma instance does not have a meta-object associated with it. So, I would first start from adding that one and linking such a PragmaType to its instances. The important thing here would be that all Pragma instances with a certain selector should reference the same PragmaType.
>>>>
>>>> Let me express a dissenting opinion. Our pragma system is minimal yet powerful. By using Message instances (with literal arguments) to represent pragmas we get
>>>> - executable pragmas that can be applied using perform: or wrappers such as sentTo:
>>>> - we can use conventional browsing queries (implementors and senders) to discover which methods are marked by a specific pragma and what pragma-processing tools implement a specific pragma.
>>>> - a rich pragma language that can have many, named parameters
>>>> - a system which doesn't need its own language, but reuses the existing Smalltalk parsing facilities, and so is easier to learn and to implement
>>>>
>>>> So its parsimony is an important part of its virtues. It is minimal.
>>>>
>>>> One thing missing from the Squeak/Pharo implementation is the set of legal pragmas a class accepts. In VisualWorks a class implements the <pragma: #pragma:selector:> (it might be <pragmas: #(pragma:selector:one: pragma:selector:two:)>) to define the legal set of pragmas. [Implementation note, these are /not/ searched for ahead of compilation; instead, the parser delays searching for class-side methods containing pragma: pragmas until it encounters a pragma, and it searches for all class side methods, including in superclasses).
>>>>
>>>> This scheme allows pragmas to be checked; only pragmas in the set of allowed pragmas are accepted, and it allows collision-free extensibility; any package can add a set of legal pragmas to a class merely by choosing a method selector that won't collide with any other containing pragma: pragmas, eg
>>>> kernelPragmas
>>>> <pragma: #primitive:>
>>>> <pragma: #primitive:error:>
>>>> <pragma: #primitive:module:>
>>>> <pragma: #primitive:module:error:>
>>>>
>>>> We're missing this, which means our compilers don't safely check for valid pragmas and can't reject invalid or unrecognized ones, which is error prone.
>>>>
>>>> If we implemented this then we would have a natural place to comment pragmas in the method that defines a particular pragma, one that would be found using senders.
>>>>
>>>> None of this requires a meta object. It is perfectly recursive; using itself to implement itself. I find this very elegant (I didn't invent pragma: pragmas; Steve Dahl did, and it's a cool idea).
>>>>
>>>> So as an inventor of pragmas I'd like to ask for the minimal implementation outlined above. I'd like that we didn't j tricycle a specific meta object, with all the additional tools that implies, and instead stick to the minimalist and parsimony of the original design and use pragmas to comment pragmas.
>>>>
>>>>> Cheers,
>>>>> Doru
>>>>
>>>> Thanks for reading.
>>>> Cheers, Eliot
>>>>
>>>>>> On Jun 27, 2016, at 12:34 PM, Denis Kudriashov <dionisiydk(a)gmail.com> wrote:
>>>>>>
>>>>>>
>>>>>> 2016-06-27 12:12 GMT+02:00 Tudor Girba <tudor(a)tudorgirba.com>:
>>>>>> Hi,
>>>>>>
>>>>>> That is my proposal as well: introduce a first class entity that describes a Pragma instance. Who would be interested to play with this?
>>>>>>
>>>>>> How it could be done?
>>>>>> Probably compiler could search preferred Pragma class for given selector. And then we will have collection of real pragma instances inside CompiledMethod. What do you think?
>>>>>
>>>>> --
>>>>> www.tudorgirba.com
>>>>> www.feenk.com
>>>>>
>>>>> "Be rather willing to give than demanding to get."
>>>
>>> --
>>> www.tudorgirba.com
>>> www.feenk.com
>>>
>>> "When people care, great things can happen."
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> --
>>> _,,,^..^,,,_
>>> best, Eliot
>>
>> --
>> www.tudorgirba.com
>> www.feenk.com
>>
>> "Not knowing how to do something is not an argument for how it cannot be done."
--
www.tudorgirba.com
www.feenk.com
"To lead is not to demand things, it is to make them happen."
July 8, 2016
Re: [Pharo-dev] Time now print24
by Eliot Miranda
Hi All,
> On Jul 7, 2016, at 9:33 AM, Eliot Miranda <eliot.miranda(a)gmail.com> wrote:
>
> Hi All,
>
> how does one produce a nice timestamp, simply date and time as in
>
> 7/7/2016 09:19:38
>
> Trivial, right?
>
> So
>
> Date today mmddyyyy, ' ', Time now print24 '7/7/2016 09:22:40.914'
>
> .914, ah, nanos. How useful. Let's get rid of them. No nanos: accessor so
>
> Date today mmddyyyy, ' ', (Time now nanos: 0) print24 => MNU
>
> but there's a seconds accessor, so
>
> Date today mmddyyyy, ' ', (Time now seconds: Time now seconds; print24) '7/7/2016 00:00:41
>
> ?? So seconds: is private, and isn't the dual of Time seconds:
>
> Time seconds
> ^ self second
> Time second
> ^ self asDuration seconds
> Duration seconds
> "Answer the number of seconds the receiver represents."
> ^seconds rem: SecondsInMinute
>
> Looks broken to me.
Let me be more explicit, and ask for permission to fix this. One basic bug is the asymmetry between seconds, an accessor that answers seconds mod 60, and seconds: that doesn't set seconds mod 60. But seconds: is private and could be replaced by eg setTotalSeconds:, presumably without breaking clients, allowing seconds: to be redefined to do the right thing.
I note that the historic bug of changing the semantics of Time now to answer something with finer resolution than one second could have been avoided by adding eg exactlyNow or preciselyNow.
The problem with nanos (apart from the horrible abbreviation) is that it presumes a maximum precision that isn't well chosen. Microseconds work out much better. And I hope we change the internal representation accordingly. But there needs to be done accessor that rounds to the nearest second without revealing the internal precision. Time now toTheNearestSecond or Time theNearestSecondNow or...?
>
> Personally I think print24 should not print sub seconds.
>
> cc'ing to Pharo because I want this timestamp to be the same in both dialects for a profiling tool we want to use in both dialects.
> _,,,^..^,,,_
> best, Eliot
July 8, 2016
Re: [Pharo-dev] Time now print24
by Cyril Ferlicot D.
Le 07/07/2016 à 18:33, Eliot Miranda a écrit :
> Hi All,
>
> how does one produce a nice timestamp, simply date and time as in
>
> 7/7/2016 09:19:38
>
> Trivial, right?
Hi Eliot,
At synectique, for a simple solution, we added a class extension:
`DateAndTime>>asSynectiqueFormat
^ '{1} {2}' format:
{(self asDate mmddyyyy). (self asTime print24 first: 8)}`
But it's true that a user will not need the milliseconds most of the
time. It would be nice to have this kind of methods directly inside
Pharo/Squeak.
>
> So
>
> Date today mmddyyyy, ' ', Time now print24 '7/7/2016 09:22:40.914'
>
> .914, ah, nanos. How useful. Let's get rid of them. No nanos: accessor so
>
> Date today mmddyyyy, ' ', (Time now nanos: 0) print24 => MNU
>
> but there's a seconds accessor, so
>
> Date today mmddyyyy, ' ', (Time now seconds: Time now seconds;
> print24) '7/7/2016 00:00:41
>
> ?? So seconds: is private, and isn't the dual of Time seconds:
>
> Time seconds
> ^ self second
> Time second
> ^ self asDuration seconds
> Duration seconds
> "Answer the number of seconds the receiver represents."
> ^seconds rem: SecondsInMinute
>
> Looks broken to me.
>
> Personally I think print24 should not print sub seconds.
>
> cc'ing to Pharo because I want this timestamp to be the same in both
> dialects for a profiling tool we want to use in both dialects.
> _,,,^..^,,,_
> best, Eliot
--
Cyril Ferlicot
http://www.synectique.eu
165 Avenue Bretagne
Lille 59000 France
July 7, 2016
Re: [Pharo-dev] Time now print24
by Eliot Miranda
Hi Sven,
> On Jul 7, 2016, at 9:47 AM, Sven Van Caekenberghe <sven(a)stfx.eu> wrote:
>
>
>> On 07 Jul 2016, at 18:33, Eliot Miranda <eliot.miranda(a)gmail.com> wrote:
>>
>> Hi All,
>>
>> how does one produce a nice timestamp, simply date and time as in
>>
>> 7/7/2016 09:19:38
>>
>> Trivial, right?
>
> I understand that you want it 'nice and clean', but the above is not precise (no TZ) and confusing (is it M/D/YYYY or D/M/YYYY ?).
>
> Going more in the ISO direction is better (more universal), IMHO.
>
> DateAndTime now rounded => "2016-07-07T18:45:12+02:00"
My use case is providing a human-readable time stamp on a benchmark output so something really simple is what's best and the full tu stamp you give above exactly opposite to what I want; verbose and hard to read.
>
>> So
>>
>> Date today mmddyyyy, ' ', Time now print24 '7/7/2016 09:22:40.914'
>>
>> .914, ah, nanos. How useful. Let's get rid of them. No nanos: accessor so
>>
>> Date today mmddyyyy, ' ', (Time now nanos: 0) print24 => MNU
>>
>> but there's a seconds accessor, so
>>
>> Date today mmddyyyy, ' ', (Time now seconds: Time now seconds; print24) '7/7/2016 00:00:41
>>
>> ?? So seconds: is private, and isn't the dual of Time seconds:
>>
>> Time seconds
>> ^ self second
>> Time second
>> ^ self asDuration seconds
>> Duration seconds
>> "Answer the number of seconds the receiver represents."
>> ^seconds rem: SecondsInMinute
>>
>> Looks broken to me.
>>
>> Personally I think print24 should not print sub seconds.
>>
>> cc'ing to Pharo because I want this timestamp to be the same in both dialects for a profiling tool we want to use in both dialects.
>> _,,,^..^,,,_
>> best, Eliot
>
>
July 7, 2016
Re: [Pharo-dev] Having comments for pragma?
by Eliot Miranda
Hi Doru,
> On Jun 30, 2016, at 1:08 PM, Tudor Girba <tudor(a)tudorgirba.com> wrote:
>
> Hi,
>
>> On Jun 27, 2016, at 7:55 PM, Eliot Miranda <eliot.miranda(a)gmail.com> wrote:
>>
>> Hi Doru,
>>
>> On Mon, Jun 27, 2016 at 6:36 AM, Tudor Girba <tudor(a)tudorgirba.com> wrote:
>> Hi Eliot,
>>
>> I agree with most things you say (except the conclusion :)), and I think that we are talking about complementary issues.
>>
>> As I mentioned before, there already is a need to distinguish between a plain selector and one that is associated with pragmas. This is what you find in PragmaType in Spotter and Inspector. This is a kind of meta-object and having it adds value. I can search for pragmas âtypeâ (we can also call it a PragmaSelector), and I can distinguish between all occurrences of a pragma âtypeâ and its utilization in computation. But, the current implementation of PragmaType is a mere pseudo-meta-object, given that it has no casual connection to the runtime.
>>
>> What we know from Smalltalk is that the analysis model does not have to differ from the runtime one. The consequence is that every time we do see a difference, we should investigate because we might uncover a hidden need opportunity.
>>
>> I know the VW model, and indeed, we could have something like:
>>
>> MyConcept class>>myPragmaDefinition
>> âa comment about the pragma"
>> <pragma: #selector>
>>
>> However, this only deals with the definition of the pragma type not with the internal representation. There could still well be an object that encapsulates both the selector and the comment. And that object would also allow us to build tools around it. We could call it a PragmaType, PragmaDefinition, or even PragmaSelector. And we could get the Pragma to point to this type either through an inst var or through a query (I would probably prefer an instvar).
>>
>> Well, there already /is/ a meta-object called Pragma, and it gets instantiated when one accesses the compiled method via pragmas:
>>
>> (CompiledMethod allInstances detect: [:m| m pragmas size > 1]) pragmas collect: [:ea| {ea. ea class}] {{<export: true> . Pragma} . {<var: #tablePtr type: 'int *'> . Pragma}}
>
> Yes I know :). An instance of Pragma denotes an concrete annotation of a method. I now would like a meta-object that describes all Pragma instances having the same selector. For example, the protocol on the class side of the Pragma class is actually a query protocol that is better suited for the instance side of a PragmaDescription meta-object. For example:
>
> Pragma class>>allNamed: aSymbol in: aClass
>
> would become
>
> PragmaDescription>>pragmasIn: aClass
>
> and you would use it like:
>
> (PragmaDescription named: aSymbol) pragmasIn: aClass
>
> Creating an instance of PragmaDescription would imply searching the image for the <pragma:> definition.
I like this.
> I would also like to have a Flyweight pool per environment such that we always get only one instance of a PragmaDefinition per selector (like it happens with Symbols).
Yes, good refinement.
>> So we could add the information you want to Pragma, and have it be lazy.
>
> It does not quite belong to the Pragma. A comment is common to all Pragma instances, and having it duplicated at the instance level is less elegant.
>
> But, looking for the users (all senders of the pragma selector - the methods that use the annotation) of a Pragma would be even less inconvenient to have on the instance side of Pragma.
>
>
>> The Pragma could go search for the defining class-side pragma methods and use the parser to extract the comment(s) when asked. Hence simple access to pragmas, interested only in the selectors for applying, wouldn't have their performance be impacted.
>
> The design sketched above would require no runtime penalty for a Pragma instance. All code that works now would work identically afterwards. We would only have one selector in Pragma to get the corresponding description:
>
> Pragma>>description
> ^ PragmaDescription named: self selector
>
> Alternatively, we could modify the compilation to associate the PragmaDescription in an inst var of a Pragma instance. So, CompiledMethod>>pragmas would always return instances of Pragmas with a PragmaDefinition inst var.
>
> I think I would start with the lazy lookup first, and this would disturb nothing from the current behavior.
Sounds like a reasonable plan.
>
>
>> I think that this proposition does not remove from the simplicity of the implementation at all, but allows the new needs to be accommodated nicely. The alternative is to not do anything, in which case we will continue to have an analysis-only-pseudo-meta-object which is not nice at all. I do not think we should jump on this lightly, but I do think we should have a critical look and evaluate the options.
>>
>> This pseudo-meta-object (Pragma) can sty ill be causally connected, in the same way that a MethodReference can be causally connected. The causation is things like "remove", "recompile", but that's dubious. It's essentially a read-only relationship; one wants to be able to locate the method from the pragma, but changing the method from the pragma isn't necessarily a good idea. Would you agree that convenience methods like "remove" on MethodReference are a bad idea and one should stick to the removeSelector: protocol on Behavior and ClassDescription?
>>
>>
>> What do you think?
>>
>> Have I and enough coffee to scramble my thoughts might be a more pertinent question ;-)
>
> :)
>
> Cheers,
> Doru
>
>
>>
>> Cheers,
>> Doru
>>
>>
>>> On Jun 27, 2016, at 2:39 PM, Eliot Miranda <eliot.miranda(a)gmail.com> wrote:
>>>
>>> Hi Doru,
>>>
>>>> On Jun 27, 2016, at 3:52 AM, Tudor Girba <tudor(a)tudorgirba.com> wrote:
>>>>
>>>> Hi,
>>>>
>>>> The CompiledMethod already has a way to retrieve Pragma instances:
>>>>
>>>> CompiledMethod>>pragmas.
>>>>
>>>> However, the Pragma instance does not have a meta-object associated with it. So, I would first start from adding that one and linking such a PragmaType to its instances. The important thing here would be that all Pragma instances with a certain selector should reference the same PragmaType.
>>>
>>> Let me express a dissenting opinion. Our pragma system is minimal yet powerful. By using Message instances (with literal arguments) to represent pragmas we get
>>> - executable pragmas that can be applied using perform: or wrappers such as sentTo:
>>> - we can use conventional browsing queries (implementors and senders) to discover which methods are marked by a specific pragma and what pragma-processing tools implement a specific pragma.
>>> - a rich pragma language that can have many, named parameters
>>> - a system which doesn't need its own language, but reuses the existing Smalltalk parsing facilities, and so is easier to learn and to implement
>>>
>>> So its parsimony is an important part of its virtues. It is minimal.
>>>
>>> One thing missing from the Squeak/Pharo implementation is the set of legal pragmas a class accepts. In VisualWorks a class implements the <pragma: #pragma:selector:> (it might be <pragmas: #(pragma:selector:one: pragma:selector:two:)>) to define the legal set of pragmas. [Implementation note, these are /not/ searched for ahead of compilation; instead, the parser delays searching for class-side methods containing pragma: pragmas until it encounters a pragma, and it searches for all class side methods, including in superclasses).
>>>
>>> This scheme allows pragmas to be checked; only pragmas in the set of allowed pragmas are accepted, and it allows collision-free extensibility; any package can add a set of legal pragmas to a class merely by choosing a method selector that won't collide with any other containing pragma: pragmas, eg
>>> kernelPragmas
>>> <pragma: #primitive:>
>>> <pragma: #primitive:error:>
>>> <pragma: #primitive:module:>
>>> <pragma: #primitive:module:error:>
>>>
>>> We're missing this, which means our compilers don't safely check for valid pragmas and can't reject invalid or unrecognized ones, which is error prone.
>>>
>>> If we implemented this then we would have a natural place to comment pragmas in the method that defines a particular pragma, one that would be found using senders.
>>>
>>> None of this requires a meta object. It is perfectly recursive; using itself to implement itself. I find this very elegant (I didn't invent pragma: pragmas; Steve Dahl did, and it's a cool idea).
>>>
>>> So as an inventor of pragmas I'd like to ask for the minimal implementation outlined above. I'd like that we didn't j tricycle a specific meta object, with all the additional tools that implies, and instead stick to the minimalist and parsimony of the original design and use pragmas to comment pragmas.
>>>
>>>> Cheers,
>>>> Doru
>>>
>>> Thanks for reading.
>>> Cheers, Eliot
>>>
>>>>> On Jun 27, 2016, at 12:34 PM, Denis Kudriashov <dionisiydk(a)gmail.com> wrote:
>>>>>
>>>>>
>>>>> 2016-06-27 12:12 GMT+02:00 Tudor Girba <tudor(a)tudorgirba.com>:
>>>>> Hi,
>>>>>
>>>>> That is my proposal as well: introduce a first class entity that describes a Pragma instance. Who would be interested to play with this?
>>>>>
>>>>> How it could be done?
>>>>> Probably compiler could search preferred Pragma class for given selector. And then we will have collection of real pragma instances inside CompiledMethod. What do you think?
>>>>
>>>> --
>>>> www.tudorgirba.com
>>>> www.feenk.com
>>>>
>>>> "Be rather willing to give than demanding to get."
>>
>> --
>> www.tudorgirba.com
>> www.feenk.com
>>
>> "When people care, great things can happen."
>>
>>
>>
>>
>>
>>
>>
>>
>> --
>> _,,,^..^,,,_
>> best, Eliot
>
> --
> www.tudorgirba.com
> www.feenk.com
>
> "Not knowing how to do something is not an argument for how it cannot be done."
>
>
July 7, 2016
Re: [Pharo-dev] [squeak-dev] Time now print24
by Chris Muller
Hi Eliot, wanted the exact same thing, a short terse representation so
I made one that employs "present context" -- e.g., if it is same day as
today, just print the time, otherwise include both the Date and Time.
This should be extended so if it is outside the current year, then it
should include the year, otherwise not.
Here's the old method, which could use a update, since #makeUTC is no
longer necessary either..
printAbbreviatedOn: aStream
| date |
(date := self asDate) makeUTC = Date today
ifTrue:
[ self asTime
print24: false
showSeconds: false
on: aStream ]
ifFalse:
[ aStream
maPrint: ((date printFormat: #(2 1 3 $/ 1 2 1 ))
copyUpToLast: $/) ;
maPrint: $@.
self asTime
print24: false
showSeconds: false
on: aStream ]
Another approach -- you could also play around with
DateAndTime>>#printYMDOn:.
On Thu, Jul 7, 2016 at 11:33 AM, Eliot Miranda <eliot.miranda(a)gmail.com> wrote:
> Hi All,
>
> how does one produce a nice timestamp, simply date and time as in
>
> 7/7/2016 09:19:38
>
> Trivial, right?
>
> So
>
> Date today mmddyyyy, ' ', Time now print24 '7/7/2016 09:22:40.914'
>
> .914, ah, nanos. How useful. Let's get rid of them. No nanos: accessor so
>
> Date today mmddyyyy, ' ', (Time now nanos: 0) print24 => MNU
>
> but there's a seconds accessor, so
>
> Date today mmddyyyy, ' ', (Time now seconds: Time now seconds; print24)
> '7/7/2016 00:00:41
>
> ?? So seconds: is private, and isn't the dual of Time seconds:
>
> Time seconds
> ^ self second
> Time second
> ^ self asDuration seconds
> Duration seconds
> "Answer the number of seconds the receiver represents."
> ^seconds rem: SecondsInMinute
>
> Looks broken to me.
>
> Personally I think print24 should not print sub seconds.
>
> cc'ing to Pharo because I want this timestamp to be the same in both
> dialects for a profiling tool we want to use in both dialects.
> _,,,^..^,,,_
> best, Eliot
>
>
>
July 7, 2016
[pharo-project/pharo-core]
by GitHub
Branch: refs/tags/60141
Home: https://github.com/pharo-project/pharo-core
July 7, 2016
[pharo-project/pharo-core] fb9425: 60141
by GitHub
Branch: refs/heads/6.0
Home: https://github.com/pharo-project/pharo-core
Commit: fb9425d70ed5405074e24c43b830fb331cd6c3a0
https://github.com/pharo-project/pharo-core/commit/fb9425d70ed5405074e24c43…
Author: Jenkins Build Server <board(a)pharo-project.org>
Date: 2016-07-07 (Thu, 07 Jul 2016)
Changed paths:
M Collections-Strings.package/Symbol.class/README.md
M Kernel.package/Deprecation.class/instance/handling/transform.st
M Kernel.package/Object.class/class/documentation/whatIsAPrimitive.st
M OpalCompiler-Tests.package/IRBuilderTest.class/instance/testing - blocks/testRemoteTemp.st
M OpalCompiler-Tests.package/OCBytecodeDecompilerTest.class/instance/examples/remoteTemp.st
M OpalCompiler-Tests.package/OCBytecodeDecompilerTest.class/instance/examples/remoteTempNested.st
R ScriptLoader60.package/ScriptLoader.class/instance/pharo - scripts/script60140.st
A ScriptLoader60.package/ScriptLoader.class/instance/pharo - scripts/script60141.st
R ScriptLoader60.package/ScriptLoader.class/instance/pharo - updates/update60140.st
A ScriptLoader60.package/ScriptLoader.class/instance/pharo - updates/update60141.st
M ScriptLoader60.package/ScriptLoader.class/instance/public/commentForCurrentUpdate.st
Log Message:
-----------
60141
17958 Add examples to the Symbol class comment
https://pharo.fogbugz.com/f/cases/17958
18618 Better additional comment for primitive: 79 error: ec usage
https://pharo.fogbugz.com/f/cases/18618
18697 Automatic deprecation refactoring needs to take traits into account
https://pharo.fogbugz.com/f/cases/18697
18700 SistaV1 bytecode: fix for Opal tests to not crash the image
https://pharo.fogbugz.com/f/cases/18700
http://files.pharo.org/image/60/60141.zip
July 7, 2016
Re: [Pharo-dev] Time now print24
by Sven Van Caekenberghe
> On 07 Jul 2016, at 18:33, Eliot Miranda <eliot.miranda(a)gmail.com> wrote:
>
> Hi All,
>
> how does one produce a nice timestamp, simply date and time as in
>
> 7/7/2016 09:19:38
>
> Trivial, right?
I understand that you want it 'nice and clean', but the above is not precise (no TZ) and confusing (is it M/D/YYYY or D/M/YYYY ?).
Going more in the ISO direction is better (more universal), IMHO.
DateAndTime now rounded => "2016-07-07T18:45:12+02:00"
> So
>
> Date today mmddyyyy, ' ', Time now print24 '7/7/2016 09:22:40.914'
>
> .914, ah, nanos. How useful. Let's get rid of them. No nanos: accessor so
>
> Date today mmddyyyy, ' ', (Time now nanos: 0) print24 => MNU
>
> but there's a seconds accessor, so
>
> Date today mmddyyyy, ' ', (Time now seconds: Time now seconds; print24) '7/7/2016 00:00:41
>
> ?? So seconds: is private, and isn't the dual of Time seconds:
>
> Time seconds
> ^ self second
> Time second
> ^ self asDuration seconds
> Duration seconds
> "Answer the number of seconds the receiver represents."
> ^seconds rem: SecondsInMinute
>
> Looks broken to me.
>
> Personally I think print24 should not print sub seconds.
>
> cc'ing to Pharo because I want this timestamp to be the same in both dialects for a profiling tool we want to use in both dialects.
> _,,,^..^,,,_
> best, Eliot
July 7, 2016